I have the following code that receives a variable and shows on the screen:
<input type="number" value={this.state.cpf} onChange={this.handleChange} name="name" />
handleChange(event) {
this.setState({cpf: event.target.value});
}
handleSignIn(event) {
alert('A name was submitted: ' + this.state.cpf);
event.preventDefault();
}
I want to remove the handleChange, to change the direct props in onChange, I tried this but it did not work:
onChange={this.setState({ cpf: target.value })}
how do I change the onChange value with this.setState?