Skip to content

Commit

Permalink
Replace deprecated lifecycle method in README
Browse files Browse the repository at this point in the history
Since React 16.3 deprecates `componentWillReceiveProps`, it would be nice to replace it with `componentDidUpdate`
  • Loading branch information
mshaaban088 authored May 9, 2018
1 parent 4f96ec0 commit be1265d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ class SandwichShop extends Component {
);
}

componentWillReceiveProps(nextProps) {
if (nextProps.forPerson !== this.props.forPerson) {
componentDidUpdate(prevProps) {
if (prevProps.forPerson !== this.props.forPerson) {
this.props.dispatch(
makeASandwichWithSecretSauce(nextProps.forPerson)
makeASandwichWithSecretSauce(this.props.forPerson)
);
}
}
Expand Down

0 comments on commit be1265d

Please sign in to comment.