React: setting the disabled attribute based on a state

You could use null

<button type='button' disabled={this.state.submitting ? 'disabled' : null} onClick={this.handleSubmit}>Submit</button>

You can set disabled property through boolean value, like this

<button
  type="button"
  disabled={this.state.submitting}
  onClick={this.handleSubmit}
>
  Submit
</button>

Example


If you wanted the disabled attr to be added dependant on some condition you can do something like this:

const disableBtnProps = {};
if (some condition) {
  disableBtnProps.disabled = false;
} else {
 disableBtnProps.disabled = true;
}

Then in your component you could do:

 <Button {...disableBtnProps} className="btn"> my button </Button>