You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The comparison option has three names: compare in usePrevious, equalityFn in useControlledState, and areValuesEqual in usePreservedReference. All three have the same type, (a, b) => boolean.
Rename the parameter to equalityFn in usePrevious and usePreservedReference. Both are positional, so only types and docs change.
Change the default in usePrevious from === to Object.is, which useControlledState and React already use. Only NaN and -0 behave differently.
Keep the deep comparison default in usePreservedReference, because keeping the reference of deeply equal values is what the hook is for.
Activity
mnxmnz commentedon Oct 6, 2026
Landed in
v1-basevia #544 🙌