diff --git a/lib/index.js b/lib/index.js index e8314a2..0b6f49d 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({ - componentWillMount: function () { + componentDidMount: function () { if (this.props.cable) { this.cable = this.props.cable } else { @@ -25,7 +25,7 @@ var ActionCableProvider = createReactClass({ } }, - componentWillReceiveProps: function (nextProps) { + getDerivedStateFromProps: function (nextProps) { // Props not changed if ( this.props.cable === nextProps.cable && @@ -38,7 +38,7 @@ var ActionCableProvider = createReactClass({ this.componentWillUnmount() // create or assign cable - this.componentWillMount() + this.componentDidMount() }, render: function () {