Skip to main content
Solid.js v2

createStore

createStore provides a way to manage complex state using mutable objects and listening to only the properties that are read.

Usage

import { For } from 'solid-js';
import { createStore } from 'solid-js/store';
function TodoApp() {
const [state, setState] = createStore({ todos: [] });
return (
<div>
<For each={state.todos}>
{(todo) => (
<div>{todo.text}</div>
)}
</For>
<button
onClick={() => setState(state => {
state.todos.push({
text: 'New Todo',
completed: false
});
})}
>
Add Todo
</button>
</div>
);
}

Last updated: 4/21/25, 10:01 AM

Edit this page on GitHub
Solid.js v2Rough WIP docs for Solid 2.0.