title: Stop decreasing number with built in condition React/JS
body: <p>I have a button that should decrease a number. How can I create a condition that stops decreasing when my number is 1 in React?</p>
  <pre class="lang-js prettyprint-override"><code>&lt;Button type=&quot;button&quot; size=&quot;small&quot; onClick={() =&gt; 
              handleUpdateCartQty(item.id, item.quantity - 1)}&gt;-&lt;/Button&gt;
  </code></pre>
  <p>something like that:</p>
  <pre class="lang-js prettyprint-override"><code>if(item.quantity == 1){
  &lt;Button type=&quot;button&quot; size=&quot;small&quot; onClick={() =&gt; 
              handleUpdateCartQty(item.id, item.quantity)}&gt;-&lt;/Button&gt;
  }else{
  &lt;Button type=&quot;button&quot; size=&quot;small&quot; onClick={() =&gt; 
              handleUpdateCartQty(item.id, item.quantity - 1)}&gt;-&lt;/Button&gt;
  }
  </code></pre>
  <p><strong>Note</strong></p>
  <p><code>item.quantity</code> holds the value of the number</p>