How to set state with a dynamic key name? Technology Community › Category: React › How to set state with a dynamic key name? 0 Vote Up Vote Down VietMX Staff asked 4 years ago If you are using ES6 or the Babel transpiler to transform your JSX code then you can accomplish this with computed property names handleInputChange : function (event) { this.setState({ [event.target.id]: event.target.value }); }