Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix React 15.5 warnings. #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 9 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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() {
Expand All @@ -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);
Expand All @@ -65,8 +67,8 @@ export function useDeps(mapper = defaultMapper) {
},

contextTypes: {
context: React.PropTypes.object,
actions: React.PropTypes.object
context: PropTypes.object,
actions: PropTypes.object
}
});

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}