react.dev
react.dev copied to clipboard
useState and useReducer docs are missing notes about stable identities
The new docs are missing the following statement for both useState
and useReducer
:
Note
React guarantees that setState function identity is stable and won’t change on re-renders. This is why it’s safe to omit from the useEffect or useCallback dependency list.
From: https://legacy.reactjs.org/docs/hooks-reference.html#usestate