In My React Component I have Radio input
<input type="radio" onChange={changeData}>
and
function changeData(e: any) {}
In My React Component I have Radio input
<input type="radio" onChange={changeData}>
and
function changeData(e: any) {}
Check this out
changeData = (e: React.ChangeEvent<HTMLInputElement>)=> {
.....
}
changeData = (e: React.MouseEvent<HTMLInputElement>): void => { // code }
You can specify the event type as React.ChangeEvent:
const changeData = (e: React.ChangeEvent<HTMLInputElement>) => {
// your implementation here
};
<input type="radio" onChange={changeData} />
The React.ChangeEvent type is a generic type that represents a change event in a DOM element. The HTMLInputElement type represents an HTML element.