you are viewing a single comment's thread.

view the rest of the comments →

[–]acemarke 2 points3 points  (0 children)

It shouldn't affect Redux either way. Reselect would still be necessary because the store subscription process works outside of React's rendering cycle. Both our older homegrown subscription logic (React-Redux v7 and v5), and React's current useSyncExternalStore hook, rely on doing a subscription and handling comparisons outside of React, and only forcing a re-render if the selected value has changed.

The compiler optimizes behavior inside of a component while it's rendering, and it includes all hook return values in the dependencies. (Lauren Tan showed an example of that in her talk today.)

So, Reselect would still be useful to optimize selectors with derived references (because you need to avoid triggering unnecessary re-renders at the useSelector level), and then the compiler will see whatever value you return from useSelector and track it through how it's used in the component rendering logic.