DEV Community

Discussion on: 10 Cool React Tips

Collapse
 
stereoplegic profile image
Mike Bybee

It's important to note that, at least until something like the proposed useContextSelector hook is implemented, you need to consider rerenders when using context for global state, and either use multiple, more localized nested contexts (which I'd recommend anyway, even if you were using Redux stores instead of context) or something like refs or JS proxies to reach up to a top level context without rerendering every time unrelated parts of that context change.

Collapse
 
alexandrudanpop profile image
Alexandru-Dan Pop

Thanks for the insights!

I want to link Mark Erikson's (Redux maintainer) blog that is like the holy Bible of React rendering behavior: blog.isquaredsoftware.com/2020/05/...