Skip to content

Commit

Permalink
changed componentDidUpdate to componentWillReceiveProps
Browse files Browse the repository at this point in the history
  • Loading branch information
urikphytech committed Feb 17, 2016
1 parent 27037ed commit 1add196
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/utils/componentLifecycleDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function componentLifecycleDecorator(_ref) {

// Stash component's own lifecycle methods to be invoked later
var componentDidMount = Component.prototype.hasOwnProperty("componentDidMount") ? Component.prototype.componentDidMount : noop;
var componentDidUpdate = Component.prototype.hasOwnProperty("componentDidUpdate") ? Component.prototype.componentDidUpdate : noop;
var componentWillReceiveProps = Component.prototype.hasOwnProperty("componentWillReceiveProps") ? Component.prototype.componentWillReceiveProps : noop;
var componentWillUnmount = Component.prototype.hasOwnProperty("componentWillUnmount") ? Component.prototype.componentWillUnmount : noop;

Object.defineProperty(Component.prototype, "componentDidMount", {
Expand All @@ -40,7 +40,7 @@ function componentLifecycleDecorator(_ref) {
}
});

Object.defineProperty(Component.prototype, "componentDidUpdate", {
Object.defineProperty(Component.prototype, "componentWillReceiveProps", {
enumerable: false,
configurable: true,
writable: true,
Expand All @@ -54,7 +54,7 @@ function componentLifecycleDecorator(_ref) {
}

// Hook into client's implementation, if it has any
componentDidUpdate.call(this, prevProps);
componentWillReceiveProps.call(this, prevProps);

register.call(this);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/componentLifecycleDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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 componentDidUpdate = Component.prototype.hasOwnProperty(`componentDidUpdate`) ? Component.prototype.componentDidUpdate : noop;
const componentWillReceiveProps = Component.prototype.hasOwnProperty(`componentWillReceiveProps`) ? Component.prototype.componentWillReceiveProps : noop;
const componentWillUnmount = Component.prototype.hasOwnProperty(`componentWillUnmount`) ? Component.prototype.componentWillUnmount : noop;

Object.defineProperty(Component.prototype, `componentDidMount`, {
Expand All @@ -33,7 +33,7 @@ export default function componentLifecycleDecorator({ registerEvents, instanceMe
},
});

Object.defineProperty(Component.prototype, `componentDidUpdate`, {
Object.defineProperty(Component.prototype, `componentWillReceiveProps`, {
enumerable: false,
configurable: true,
writable: true,
Expand All @@ -47,7 +47,7 @@ export default function componentLifecycleDecorator({ registerEvents, instanceMe
}

// Hook into client's implementation, if it has any
componentDidUpdate.call(this, prevProps);
componentWillReceiveProps.call(this, prevProps);

register.call(this);
},
Expand Down

0 comments on commit 1add196

Please sign in to comment.