QuizNot attempted
Typing an input change handler
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
ChangeEvent<HTMLInputElement>
- React types an input's
onChangeasChangeEventHandler<HTMLInputElement>, so the extracted function takesChangeEvent<HTMLInputElement>ande.target.valueis typed. - Not Event: the DOM
Eventisn't React's synthetic event andtargetis untyped. - Not MouseEvent: that is for clicks.
- Not FormEvent<HTMLFormElement>: that is for a form's
onSubmit.