From 105dc6bcfa9f1647968d028d499c88c7f6a1f25a Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Sun, 21 Feb 2016 18:42:58 +0800 Subject: [PATCH] fix(componentLifecycleDecorator): revert to componentWillReceiveProps * This reverts commit b42b58e702c828cac0fe167fa78a67fc4301ff6b. * Ref #206 --- src/utils/componentLifecycleDecorator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); },