From 57eb7cc3f3f16efb5bfab52187da54103bb21ccd Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Thu, 29 Mar 2018 08:41:49 -0700 Subject: [PATCH] Tweaked message about what goes into state --- content/docs/state-and-lifecycle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/state-and-lifecycle.md b/content/docs/state-and-lifecycle.md index 43bccdb8..21e91f4b 100644 --- a/content/docs/state-and-lifecycle.md +++ b/content/docs/state-and-lifecycle.md @@ -251,7 +251,7 @@ Note how we save the timer ID right on `this`. While `this.props` is set up by React itself and `this.state` has a special meaning, you are free to add additional fields to the class manually if you need to store something that is not used for the visual output. -If you don't use something in `render()`, it shouldn't be in the state. +State is generally used to store values that are referenced by `render()` (for visual output) or by `getDerivedStateFromProps()` (to compare next and previous props values). We will tear down the timer in the `componentWillUnmount()` lifecycle hook: