State Pattern
Select local vs global state and implement the pattern with best practices.
When to Use
- •Use this skill when state is shared across multiple components or routes.
Inputs
- •State shape and lifecycle
- •Consumers and update frequency
- •Persistence or caching needs
Instructions
- •Decide local vs global state (justify decision).
- •Implement store or context if global.
- •Add selectors or derived state helpers.
- •Add tests for state updates and selectors.
Output
- •State implementation with tests and a short rationale.