Reactjs setState() with a dynamic key name?

Thanks to @Cory’s hint, i used this: inputChangeHandler : function (event) { var stateObject = function() { returnObj = {}; returnObj[this.target.id] = this.target.value; return returnObj; }.bind(event)(); this.setState( stateObject ); }, If using ES6 or the Babel transpiler to transform your JSX code, you can accomplish this with computed property names, too: inputChangeHandler : function (event) … Read more