react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

useState and useReducer docs are missing notes about stable identities

Open vhakulinen opened this issue 1 year ago • 0 comments

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

vhakulinen avatar Mar 17 '23 13:03 vhakulinen