-
Notifications
You must be signed in to change notification settings - Fork 49k
Open
Labels
Component: HooksReact Core TeamOpened by a member of the React Core TeamOpened by a member of the React Core Team
Description
This is related to #14092, #14066, reactjs/rfcs#83, and some other issues.
The problem is that we often want to avoid invalidating a callback (e.g. to preserve shallow equality below or to avoid re-subscriptions in the effects). But if it depends on props or state, it's likely it'll invalidate too often. See #14092 (comment) for current workarounds.
useReducer
doesn't suffer from this because the reducer is evaluated directly in the render phase. @sebmarkbage had an idea about giving useCallback
similar semantics but it'll likely require complex implementation work. Seems like we'd have to do something like this though.
I'm filing this just to acknowledge the issue exists, and to track further work on this.
kafein, philipp-spiess, Jessidhia, NE-SmallTown, latviancoder and 163 morenadavl, andycarrell, raajnadar, Nabeel20, jlarmstrongiv and 7 more
Metadata
Metadata
Assignees
Labels
Component: HooksReact Core TeamOpened by a member of the React Core TeamOpened by a member of the React Core Team