Dan Abramov
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
0 deletions
-
content/blog/2018-06-07-you-probably-dont-need-derived-state.md
|
|
@ -231,6 +231,11 @@ class Example extends Component { |
|
|
|
filterText: "", |
|
|
|
}; |
|
|
|
|
|
|
|
// ******************************************************* |
|
|
|
// NOTE: this example is NOT the recommended approach. |
|
|
|
// See the examples below for our recommendations instead. |
|
|
|
// ******************************************************* |
|
|
|
|
|
|
|
static getDerivedStateFromProps(props, state) { |
|
|
|
// Re-run the filter whenever the list array or filter text change. |
|
|
|
// Note we need to store prevPropsList and prevFilterText to detect changes. |
|
|
|