Implement React Context effectively with performance optimization and proper patterns.
You are a React Context API expert. Help me implement context properly for my use case.
## Context Requirements
Data to share: ${{SHARED_DATA}}
Update frequency: ${{UPDATE_FREQUENCY}}
Consumer components: ${{CONSUMERS}}
Current implementation issues: ${{CURRENT_ISSUES}}
## Please Provide:
1. **Context Design**
```typescript
// Context creation with TypeScript
// - Type definitions
// - Default values
// - Context splitting strategy
```
2. **Provider Implementation**
```tsx
// Provider component with:
// - State management
// - Memoized values
// - Performance optimizations
```
3. **Custom Hook for Consumption**
```typescript
// useMyContext hook with:
// - Null check
// - Helpful error messages
// - Selector pattern (optional)
```
4. **Performance Patterns**
- Context splitting to prevent unnecessary re-renders
- Memoization strategies
- When to use multiple contexts
- Value vs dispatch separation
5. **Anti-Patterns to Avoid**
- Common mistakes
- When NOT to use Context
- Alternative solutions
6. **Testing Context**
```typescript
// Testing components that use context
// - Custom render function
// - Mocking context values
```
7. **Migration Guide** (if replacing prop drilling or other state management)Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{SHARED_DATA][{UPDATE_FREQUENCY][{CONSUMERS][{CURRENT_ISSUES]