Skip to content

Commit 5453a06

Browse files
authored
Merge pull request reactjs#88 from jedwards1211/patch-1
Caution (in docs) against dispatching redux actions or triggering component updates by any other means in `componentWillUpdate`
2 parents be1f9a6 + d5ebad1 commit 5453a06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/docs/reference-react-component.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ componentWillUpdate(nextProps, nextState)
216216

217217
`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.
218218

219-
Note that you cannot call `this.setState()` here. If you need to update state in response to a prop change, use `componentWillReceiveProps()` instead.
219+
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.
220220

221221
> Note
222222
>

0 commit comments

Comments
 (0)