arrow_backBACK TO DRILLS
Blue BelteventsPREMIUM
Passing e.target to a FormData Constructor
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?