Investigate adding a proxy-based selector API
See original GitHub issueBoth our connect
and useSelector
APIs rely on the user manually specifying what pieces of state to extract to determine re-renders.
@dai-shi has done some amazing work with using ES6 Proxies to manage tracking the pieces of state that are actually needed by a component, particularly in his https://github.com/dai-shi/reactive-react-redux library.
I’ve said several times that I kinda see that lib as a sort of alpha test for whether an approach like that should be added to React-Redux itself. Now that our hooks API has been stable for a while, it might be time to start discussing that idea more seriously.
This may also have some relevance to the Concurrent Mode questions over in #1351 .
Ideally, anything we add would be completely tree-shakeable by default, so that it doesn’t increase bundle size unless the API is actually used.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:19 (13 by maintainers)
Top GitHub Comments
FWIW, we decided against the
useReduxState
name early on in the planning process for hooks.Ideally
useTrackedState
should also report an “illegal” uses, when to many entities are being tracked. Personally, for the last year, I am using tracked selectors mostly to “prove” than my manual selectors are working correctly, and will continue doing it correctly and performant(!) without tracking as well.