Optimize React Context usage to prevent unnecessary re-renders and improve performance.
I need help optimizing my React Context implementation. **Current Context Setup:** ```jsx [paste your current context code] ``` **Consumer Components:** [Describe components using this context] **Performance Issues:** - Observed re-renders: [describe] - Profiler results: [if available] - User-facing lag: [describe] **State Update Frequency:** [How often does context state change] **Requirements:** - State that changes frequently: [list it] - State that rarely changes: [list it] - Actions/methods needed: [list them] Please provide: 1. Optimized context structure 2. Context splitting strategy 3. Memoization implementation 4. Custom hook for consumers 5. Provider component optimization 6. Before/after render comparison 7. Alternative solutions if applicable
Or press ⌘C to copy