createEffect in SolidJS

From the SolidJS cheat sheet · Effects & Memos · verified Jul 2026

createEffect

Run a side effect that automatically re-executes when its signal dependencies change.

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

const [count, setCount] = createSignal(0);
createEffect(() => {
  console.log("Count is:", count());
});
💡 Effects auto-track dependencies — any signal called inside is a dependency
⚡ Effects run synchronously after render and re-run when dependencies change
📌 Return a value from the effect callback to access it as the previous value on next run
🟢 Use createEffect for side effects like logging, DOM manipulation, or external API calls
effectsreactivityside-effects

More SolidJS tasks

Back to the full SolidJS cheat sheet