Browse Source

Merge pull request #88 from jedwards1211/patch-1

Caution (in docs) against dispatching redux actions or triggering component updates by any other means in `componentWillUpdate`
main
Brian Vaughn 7 years ago
committed by GitHub
parent
commit
5453a06528
  1. 2
      content/docs/reference-react-component.md

2
content/docs/reference-react-component.md

@ -216,7 +216,7 @@ componentWillUpdate(nextProps, nextState)
`componentWillUpdate()` is invoked immediately before rendering when new props or state are being received. Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render. `componentWillUpdate()` is invoked immediately before rendering when new props or state are being received. Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render.
Note that you cannot call `this.setState()` here. If you need to update state in response to a prop change, use `componentWillReceiveProps()` instead. Note that you cannot call `this.setState()` here; nor should you do anything else (eg dispatch a redux action) that would trigger an update to a React component before `componentWillUpdate` returns. Use `componentWillReceiveProps()` if you need to update `state` in response to `props` changes.
> Note > Note
> >

Loading…
Cancel
Save