Memos and effects
createMemo derives cached values, and createEffect runs side effects.
What you will be able to do
- Use createMemo for derived state.
- Use createEffect for side effects.
- Dependencies are tracked automatically.
In plain English
createMemo derives cached values, and createEffect runs side effects.
- Use createMemo for derived state.
- Use createEffect for side effects.
- Dependencies are tracked automatically.
import { createMemo, createSignal } from 'solid-js'
export default function Double() {
const [count, setCount] = createSignal(1)
const double = createMemo(() => count() * 2)
return <p>{count()} doubled is {double()}</p>
}Your turn
EasyExplain it back
Answer from memory: Which primitive caches a derived value?
TEXT · starter
Your answer…Check your understanding before moving on.
Knowledge checkQuestion 1
Which primitive caches a derived value?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.