So you want to use useState and useContext as a state management solution, but every time the value of the context provider changes the entire tree gets re-rendered. You could use a library like RecoilValtioZustand, and Jotai to get around this problem, but you’d have to change how you store and access global state.

Is there a way to just fix the issues with useContext? Glad you asked! Yes there is! It’s react-tracked, a new library from Daishi Kato, who has been doing amazing work in the React state management space.

#javascript

Fixing useContext Performance Issues
1.10 GEEK