I have this in constructor
this.state = {
inputs : {}
}
This in handleInputChange (triggered on blur of input)
handleInputChange(event) {
const target = event.target;
const value = target.value;
const name = target.name;
this.setState({
inputs[name]: value
});
}
So that my state will look like
inputs : { name1 : "text1", "name2": "text2" }
I am getting this syntax error
Unexpected token, expected , (20:12)
this.setState({
> 20 | inputs[name]: value
| ^
21 | });
What is the correct syntax for this?