π
Context & useReducer
IntermediateShare state across the component tree without prop drilling
When to use Context
Context is for global, infrequently-updated data: user auth, theme, language, permissions. For frequently-updated state (every keystroke), Context causes performance issues β use Zustand or Redux instead.createContext & useContext β Avoid Prop Drilling
intermediateContext provides a way to pass data through the component tree without having to pass props down manually at every level.
Context + useReducer β Mini Redux Pattern
intermediateCombine Context (for global access) with useReducer (for complex state transitions) to build a scalable state system without external libraries.
Context Performance Optimization
advancedContext re-renders ALL consumers when value changes. Split contexts, memoize values, and use selectors to prevent costly re-renders.