diff --git a/lib/index.js b/lib/index.js index 9723aec..ab5b2b1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,7 @@ -import React from 'react'; +import React from 'react'; // eslint-disable-line no-unused-vars import hoistStatics from 'hoist-non-react-statics'; +import PropTypes from 'prop-types'; +import createReactClass from 'create-react-class'; const getDisplayName = Component => ( Component.displayName || Component.name || 'Component' @@ -21,10 +23,10 @@ export function injectDeps(context, _actions) { } return function (Component) { - const ComponentWithDeps = React.createClass({ + const ComponentWithDeps = createReactClass({ childContextTypes: { - context: React.PropTypes.object, - actions: React.PropTypes.object + context: PropTypes.object, + actions: PropTypes.object }, getChildContext() { @@ -51,7 +53,7 @@ const defaultMapper = (context, actions) => ({ export function useDeps(mapper = defaultMapper) { return function (Component) { - const ComponentUseDeps = React.createClass({ + const ComponentUseDeps = createReactClass({ render() { const {context, actions} = this.context; const mappedProps = mapper(context, actions); @@ -65,8 +67,8 @@ export function useDeps(mapper = defaultMapper) { }, contextTypes: { - context: React.PropTypes.object, - actions: React.PropTypes.object + context: PropTypes.object, + actions: PropTypes.object } }); diff --git a/package.json b/package.json index 1099e6f..171796f 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ }, "dependencies": { "babel-runtime": "6.x.x", - "hoist-non-react-statics": "1.x.x" + "create-react-class": "^15.5.3", + "hoist-non-react-statics": "1.x.x", + "prop-types": "^15.5.10" } }