diff --git a/index.js b/index.js index 857a506..cbfd670 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; var React = require('react'), + PropTypes = require('prop-types'), withSideEffect = require('react-side-effect'); function reducePropsToState(propsList) { @@ -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), { + constructor: DocumentTitle, render: function render() { if (this.props.children) { return React.Children.only(this.props.children); @@ -33,6 +34,10 @@ var DocumentTitle = React.createClass({ } }); +DocumentTitle.propTypes = { + title: PropTypes.string.isRequired +}; + module.exports = withSideEffect( reducePropsToState, handleStateChangeOnClient diff --git a/package.json b/package.json index 7926dac..dc44bb1 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "react": "^0.13.0" }, "dependencies": { + "prop-types": "^15.5.0", + "react": "^15.5.0", "react-side-effect": "^1.0.2" } }