Answer the question
In order to leave comments, you need to log in
What type to specify for Event?
there is an input with attributes name & value; I write a handler in which I want to pull out these values, but I get:
Property 'name' does not exist on type 'EventTarget'
const handleChange = (event: React.FormEvent) => {
console.log(event.target.name)
}
Answer the question
In order to leave comments, you need to log in
const handleChange = (event: React.FormEvent<HTMLFormElement>) => {
console.log(event.currentTarget.name)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question