Jul 2, 2019 in React JS
Q:

How to set state with a dynamic key name?

1 Answer

0 votes
Jul 2, 2019

If you are using ES6 or the Babel transpiler to transform your JSX code then you can accomplish this with computed property names.

handleInputChange(event) {
  this.setState({ [event.target.id]: event.target.value })
}
Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
Jul 2, 2019 in React JS
...