zustand-entities
Installation
SKILL.md
Zustand Entities
Use Zustand as a simple state store for entity management.
Technique
Store entities in a Zustand store array. Systems read from the store directly (non-reactively) in useFrame, while React components subscribe to the store for re-rendering when entities are added or removed.
Key Concepts
- Not a true ECS, but simple and effective for many cases
- Store entities in an array with
create() - Use
getState()in systems for non-reactive access (no re-renders) - Use
useStore(selector)in components for reactive updates - Memoize entity components to prevent unnecessary re-renders
- Re-renders happen when entities are added/removed from the array
Usage
Related skills
More from verekia/r3f-gamedev
smooth-interpolation
Animate values smoothly using exponential decay instead of linear interpolation.
13ui-useframe
Sync UI elements outside the Canvas with the render loop using R3F v10's external useFrame.
8r3f-setup
Set up a React Three Fiber project with WebGPU support.
7reactive-polling
Poll for changes to any value and trigger React re-renders when it changes.
7miniplex
Use Miniplex for minimalistic Entity Component System with TypeScript support.
6bone-attachment
Attach meshes to bones of a skinned mesh, such as attaching a sword to a character's hand.
6