F
F
fif2022-03-25 23:10:16
typescript
fif, 2022-03-25 23:10:16

What type is onchange(input)?

I use React + TypeScript.
This is how I wrote in the input:

<input value={this.val} onChange={this.handleInputChange} className="header-input" type="text" />


And this is how I wrote the handleInputChange method :
handleInputChange(event) {
    this.val = event.target.value;
}

The question is what type should I give to event ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Sokolov, 2022-03-25
@fif

React.ChangeEvent<HTMLInputElement>
And there event.target.valuewo n't beevent.currentTarget.value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question