Browse Source

[beta] Push people away more from setting state in render (#4299)

* [beta] Push people away more from setting state in render

* Backticks
main
Sophie Alpert 3 years ago
committed by GitHub
parent
commit
5d2a4e369a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/pages/apis/usestate.md

2
beta/src/pages/apis/usestate.md

@ -790,7 +790,7 @@ Usually, you will update state in event handlers. However, **in rare cases you m
In most cases you don't need derived state:
* If you want to always copy a prop into state, [remove that redundant state altogether.](/learn/choosing-the-state-structure#avoid-redundant-state)
* **If the value you need can be computed entirely from the current props or other state, [remove that redundant state altogether](/learn/choosing-the-state-structure#avoid-redundant-state).** If you're worried about recomputing too often, the [`useMemo` Hook](/apis/usememo) can help.
* If you want to reset the entire component tree's state, [pass a different `key` to your component.](#resetting-state-with-a-key)
* If you can, update all the relevant state in the event handlers.

Loading…
Cancel
Save