QuizNot attempted
Passing setState down
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
Dispatch<SetStateAction<number>>
useState<number>returns a setter typedDispatch<SetStateAction<number>>, whereSetStateAction<number>isnumber | ((prev: number) => number), so the child can use functional updates.- Not (n: number) => void: compiles for direct calls but forbids the updater form.
- Not Function: untyped, accepts anything.
- Not SetState<number>: React exports no such type.