React TypeScript 2.3 -> typesafe React Bootstrap FormControl onChange React TypeScript 2.3 -> typesafe React Bootstrap FormControl onChange typescript typescript

React TypeScript 2.3 -> typesafe React Bootstrap FormControl onChange


Solved it like this:

handleChange(event: React.ChangeEvent<HTMLInputElement>) {    const target = event.target;    const value = target.type === 'checkbox' ? target.checked : target.value;    const name = target.name as any;    this.setState({        [name]: value    });}...<FormControl name="email" type="email" value={this.state.email} onChange={(event) => this.handleChange(event as any)} placeholder="Email" />