TypeScript · Junior · Question 23 of 75

What is the type of the event in onChange for an <input> in React?

Explanation

React uses its own synthetic events: ChangeEvent, MouseEvent<HTMLButtonElement>, FormEvent<HTMLFormElement> and so on. The generic specifies the element, so e.target.value is typed. If the handler is inline, the type is inferred automatically.

Further reading

Problem with a question

TypeScript · Junior · question 23

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz