The handleChange()
function is called whenever the input element is changed, but can't seem to access event.target.value
.
Error Message
Property 'target' does not exist on type 'HTMLInputElement'. TS2339
handleChange()
handleChange = (event:HTMLInputElement) => {
console.log(event);
const { name, value } = event.target;
this.setState({[name]: value});
};
Input Element
<input name='email' type='email' value={this.state.email} onChange={this.handleChange} required />