arrow_backBACK TO DRILLS
Blue BelteventsPREMIUM
e.target vs e.currentTarget - TypeScript Knows the Type of currentTarget but Not target
A form submit handler is typed as FormEvent<HTMLFormElement> and needs to construct a FormData object from the form element.
REACT_MODULE // 0x42
function handleSubmit(e: FormEvent<HTMLFormElement>) {
const data = new FormData(e.target);
}Why does TypeScript reject e.target here with a type error, and what is the correct fix?