Context is a form of Dependency Injection. It is a transport mechanism - it doesn't "manage" anything. Any "state management" is done by you and your own code, typically via useState/useReducer.
as stated here
-
If you context contains many values, be aware that if only one of them changes, all consumers (components which use
useContext)will re-render (many of such re-renders might be unncecessary). -
This can be avoided by
- splitting your context into multiple contexts (see https://react.dev/learn/scaling-up-with-reducer-and-context)
- by using
useMemoto memoize the context value ThemeConsumercomponent withReact.memo- use-context-selector
-
Alternative: Replace by atomic solutions like
JotaiorZustand
TODO: Create example CodeSandBoxes for all scenarios
UNDER CONSTRUCTION
UNDER CONSTRUCTION