r3f-state-management
Installation
SKILL.md
R3F State Management
When to Use
Use this skill when:
- Managing global game state in R3F
- Sharing state between 3D and UI components
- Implementing player state, inventory, score
- Coordinating multiple 3D objects
- Optimizing state updates for performance
Core Principles
- Zustand for Global State: Fast, minimal re-renders
- React Context for Scoped State: Component trees
- Local State for Component-Only: useState
- Immutable Updates: Never mutate state directly
- Selectors for Performance: Subscribe to slices
- Avoid Props Drilling: Use stores or context