diff --git a/src/utils/componentLifecycleDecorator.js b/src/utils/componentLifecycleDecorator.js index 023d49b8..702b9a25 100644 --- a/src/utils/componentLifecycleDecorator.js +++ b/src/utils/componentLifecycleDecorator.js @@ -20,7 +20,7 @@ export default function componentLifecycleDecorator({ registerEvents, instanceMe // Stash component's own lifecycle methods to be invoked later const componentDidMount = Component.prototype.hasOwnProperty(`componentDidMount`) ? Component.prototype.componentDidMount : noop; - const componentWillReceiveProps = Component.prototype.hasOwnProperty(`componentWillReceiveProps`) ? Component.prototype.componentWillReceiveProps : noop; + const componentDidUpdate = Component.prototype.hasOwnProperty(`componentDidUpdate`) ? Component.prototype.componentDidUpdate : noop; const componentWillUnmount = Component.prototype.hasOwnProperty(`componentWillUnmount`) ? Component.prototype.componentWillUnmount : noop; Object.defineProperty(Component.prototype, `componentDidMount`, { @@ -35,7 +35,7 @@ export default function componentLifecycleDecorator({ registerEvents, instanceMe }, }); - Object.defineProperty(Component.prototype, `componentWillReceiveProps`, { + Object.defineProperty(Component.prototype, `componentDidUpdate`, { enumerable: false, configurable: true, writable: true, @@ -49,7 +49,7 @@ export default function componentLifecycleDecorator({ registerEvents, instanceMe } // Hook into client's implementation, if it has any - componentWillReceiveProps.call(this, prevProps); + componentDidUpdate.call(this, prevProps); register.call(this); },