'React(Typescript) onchange event type

In My React Component I have Radio input

<input type="radio" onChange={changeData}>

and

function changeData(e: any) {}

How can I specify event type I don't want to use any. enter image description here



Solution 1:[1]

Check this out

changeData = (e: React.ChangeEvent<HTMLInputElement>)=> {
    .....
}

Solution 2:[2]

changeData = (e: React.MouseEvent<HTMLInputElement>): void => { // code }

Solution 3:[3]

One might want to write it this way:

const changeData: React.ChangeEventHandler | undefined = 
  (event: React.ChangeEvent<HTMLTextAreaElement>) => {}

and then

<input type="radio" onChange={changeData}>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kalhan.Toress
Solution 2
Solution 3 Roman