createStore in SolidJS

From the SolidJS cheat sheet ยท Stores ยท verified Jul 2026

createStore

Create a reactive store for complex nested state with path-based updates.

typescript
// Quick Reference
import { createStore } from "solid-js/store";

const [state, setState] = createStore({ count: 0, user: { name: "Alice" } });
setState("count", 1);
setState("user", "name", "Bob");
๐Ÿ’ก Store properties are accessed directly (state.count) โ€” no getter function call needed
โšก Path-based setState only triggers updates for the exact changed property
๐Ÿ“Œ Use a function as a path segment to match array items by condition
๐ŸŸข Stores are ideal for complex state โ€” signals are better for simple atomic values
storesstatenested

More SolidJS tasks

Back to the full SolidJS cheat sheet