setState conditionally in react
I know some react but I am stuck in a weird situation. I have two inputs and a button, the button should be enabled when both inputs are not empty. So, I used a state property for each input value and also one property telling me if both inputs have value: this.state = { title: '', time :'', enabled : false } also I have a onChange for each input to set State accordingly: <input type="text" id="time" name="time" onChange={this.onChange.bind(this)} value={this.state.time}></input> <input type="text" id="title" name="title" onChange={this.onChange.bind(this)} value={this.state.title}></input>