QuizNot attempted
Lazy initializer captures the first value
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
hi
- The lazy initializer
() => [text]runs only on mount, capturingtextas'hi' - later changes to
textnever touchlist, so it showshi. - Not hello:
listisn't derived fromtexton each render. - Not hi,hello: nothing ever appends to
list. - Not empty: the initializer did run once.
- If you want a derived value, compute it during render instead of storing it.