title: Dynamic attribute in ReactJS
body: <p>I want to dynamically include/omit the disabled attribute on a button element. I have seen plenty of examples of dynamic attribute values, but not of attributes themselves. I have the following render function:</p>
  
  <pre><code>render: function() {
      var maybeDisabled = AppStore.cartIsEmpty() ? "disabled" : "";
      return &lt;button {maybeDisabled}&gt;Clear cart&lt;/button&gt;
  }
  </code></pre>
  
  <p>This throws a parse error because of the "{" character. How can I include/omit the disabled attribute based on the (boolean) result of AppStore.cartIsEmpty()?</p>