Latihan 2 dari materi Stores Solid di SolidJS: praktik dengan editor kode interaktif, test case otomatis, dan hint terpandu, langsung di browser.
Kode awal punya App dengan <div> kosong dan komentar TODO. Buat store untuk daftar todo:
createStore dari "solid-js/store" (dan For dari "solid-js").App, tulis const [state, setState] = createStore({ todos: ["Belajar Solid", "Buat proyek"], input: "" }).<div>, tulis <p>Total: {state.todos.length} todos</p>, supaya berbunyi Total: 2 todos.<ul> dengan satu <li> per todo: <For each={state.todos}>{(todo) => <li>{todo}</li>}</For>.Yang dicek:
createStore.<ul>.<p> memuat Total: 2, dibaca dari store: {state.todos.length}.2 <li> di dalam <ul>, lahir dari state.todos lewat <For each={state.todos}> (atau state.todos.map).