From 9b72ba6f05326e9f9af2045b218c7d60df629033 Mon Sep 17 00:00:00 2001 From: barnonahill Date: Sun, 20 May 2018 18:52:19 -0400 Subject: [PATCH] Add a sentence to the end of componentWillUnmount() (#894) Adds a sentence explaining not to use setState in componentWillUnmount, see https://github.com/facebook/react/issues/12111 --- content/docs/reference-react-component.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reference-react-component.md b/content/docs/reference-react-component.md index 71ff51a3..58b01238 100644 --- a/content/docs/reference-react-component.md +++ b/content/docs/reference-react-component.md @@ -329,7 +329,7 @@ If your component implements the `getSnapshotBeforeUpdate()` lifecycle, the valu componentWillUnmount() ``` -`componentWillUnmount()` is invoked immediately before a component is unmounted and destroyed. Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any subscriptions that were created in `componentDidMount()`. +`componentWillUnmount()` is invoked immediately before a component is unmounted and destroyed. Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any subscriptions that were created in `componentDidMount()`. You should not call `setState()` here because the component will never be re-rendered. * * *