createMemo in SolidJS
From the SolidJS cheat sheet ยท Effects & Memos ยท verified Jul 2026
createMemo
Create a cached derived value that only recomputes when its dependencies change.
typescript
// Quick Reference
import { createSignal, createMemo } from "solid-js";
const [count, setCount] = createSignal(0);
const isEven = createMemo(() => count() % 2 === 0);
console.log(isEven()); // true๐ก createMemo caches its result โ unlike derived signals, it only recomputes when dependencies change
โก Memos are themselves signals and can be tracked by effects and other memos
๐ Use memos for expensive computations or values read in multiple places
๐ข Think of createMemo as a derived signal with built-in caching
memocomputedcaching