2021年3月19日星期五

How do I add event listener 'on change' to an input element with React?

In React, onChange in the following code is regarded as an on input event handler, not on change, if I understand correctly:

<input onChange={() => ()}></input>  

But I do want to handle on change events. How do I do that?

Updates:

In React, onChange will be triggered on input events, so it cannot handle on-change events (for HTMLInputElement).

I want to handle on-change events, not on-input events.

https://stackoverflow.com/questions/66702738/how-do-i-add-event-listener-on-change-to-an-input-element-with-react March 19, 2021 at 01:00PM

没有评论:

发表评论