createSignal in SolidJS

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

createSignal

Create a reactive signal that returns a getter function and a setter function.

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

const [count, setCount] = createSignal(0);
console.log(count()); // 0
setCount(5);          // set directly
setCount(prev => prev + 1); // functional update
๐Ÿ’ก Signals return getter functions โ€” always call them with () to read the value
โšก Setter accepts a direct value or a callback receiving the previous value
๐Ÿ“Œ Pass { equals: false } to always notify subscribers even if value is unchanged
๐ŸŸข Signals are the foundation of all reactivity in SolidJS
signalsstatereactivity

Continue with SolidJS

Save the full cheat sheet or work through every related task.

More SolidJS tasks

Back to the full SolidJS cheat sheet