solid-impl-state-patterns
Installation
SKILL.md
solid-impl-state-patterns
Quick Reference
State Primitives Overview
| Primitive | Import | Use Case | Access Syntax |
|---|---|---|---|
createSignal |
solid-js |
Single values, primitives, toggles | signal() (getter function) |
createStore |
solid-js/store |
Nested objects, arrays, complex state | store.prop (direct access) |
createContext |
solid-js |
Shared state across component tree | Provider + useContext |
createMemo |
solid-js |
Derived/computed values | memo() (getter function) |
createMutable |
solid-js/store |
MobX/Vue migration only | state.prop (direct mutation) |
Critical Warnings
NEVER use createEffect to synchronize derived state — ALWAYS use createMemo instead. Effects are for side effects (DOM, network, logging), not for computing values from other signals.
NEVER store signal values in variables outside tracking scopes — the variable captures a snapshot, not a reactive binding. ALWAYS call the getter function where you need the current value.