diff --git a/lib/index.js b/lib/index.js index 6953192..4e4536b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -11,7 +11,7 @@ var createReactClass = require("create-react-class") var { Provider, Consumer } = React.createContext() var ActionCableProvider = createReactClass({ - UNSAFE_componentWillMount: function () { + componentDidMount: function () { if (this.props.cable) { this.cable = this.props.cable } else { @@ -25,11 +25,11 @@ var ActionCableProvider = createReactClass({ } }, - UNSAFE_componentWillReceiveProps: function (nextProps) { + componentDidUpdate: function (prevProps) { // Props not changed if ( - this.props.cable === nextProps.cable && - this.props.url === nextProps.url + this.props.cable === prevProps.cable && + this.props.url === prevProps.url ) { return } @@ -38,7 +38,7 @@ var ActionCableProvider = createReactClass({ this.componentWillUnmount() // create or assign cable - this.UNSAFE_componentWillMount() + this.componentDidMount() }, render: function () {