React Typescript form event code example
Example 1: react event typescript
handleChange(e: React.ChangeEvent<HTMLInputElement>) {
// No longer need to cast to any - hooray for react!
this.setState({temperature: e.target.value});
}
render() {
...
<input value={temperature} onChange={this.handleChange} />
...
);
}
Example 2: React Typescript form event
// onSubmit or handleSubmit
handleSubmit(eventL FormEvent<HTMLFormElement>) {
}