typescript click event type code example
Example 1: typescript onclick event type props
interface IProps_Square {
message: string;
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
}
Example 2: react onclick typescript type
onClick={(event: React.MouseEvent<HTMLElement>) => {
makeMove(ownMark, (event.target as any).index)
}}
Example 3: react event typescript
handleChange(e: React.ChangeEvent<HTMLInputElement>) {
this.setState({temperature: e.target.value});
}
render() {
...
<input value={temperature} onChange={this.handleChange} />
...
);
}