'React(Typescript) onchange event type
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 |