QuizNot attempted
currentTarget vs target
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- (2):
targetis onlyEventTarget
- The element generic types
currentTarget, the element the handler is attached to, whiletargetis whatever was actually clicked (maybe a child<span>), so React types it as plainEventTarget. - Not (1):
currentTargetisHTMLButtonElement. - Not both: only
targetis loose. - Not neither:
EventTargethas nodisabled. - Likewise a bare
ChangeEventdefaults toElement, soe.target.valuefails until you writeChangeEvent<HTMLInputElement>.