Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var React = require('react'),
PropTypes = require('prop-types'),
withSideEffect = require('react-side-effect');

function reducePropsToState(propsList) {
Expand All @@ -17,13 +18,13 @@ function handleStateChangeOnClient(title) {
}
}

var DocumentTitle = React.createClass({
displayName: 'DocumentTitle',

propTypes: {
title: React.PropTypes.string.isRequired
},
function DocumentTitle() {
React.Component.call(this);
this.displayName = 'DocumentTitle';
}

DocumentTitle.prototype = Object.assign(Object.create(React.Component.prototype), {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constructor: DocumentTitle,
render: function render() {
if (this.props.children) {
return React.Children.only(this.props.children);
Expand All @@ -33,6 +34,10 @@ var DocumentTitle = React.createClass({
}
});

DocumentTitle.propTypes = {
title: PropTypes.string.isRequired
};

module.exports = withSideEffect(
reducePropsToState,
handleStateChangeOnClient
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"react": "^0.13.0"
},
"dependencies": {
"prop-types": "^15.5.0",
"react": "^15.5.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure we wouldn't want to pull in our own copy of react here. Perhaps as a peer dependency?

"react-side-effect": "^1.0.2"
}
}