title: How do i change the color of a button when clicked in react?
body: <p>I am new to <code>react</code> and i am trying to use the <code>useState</code> hook to change the color of a button when clicked. Please how do i go about it . Here is the code below</p>
  <pre class="lang-js prettyprint-override"><code>import { Button } from 'bootstrap'
  import React, { useState } from 'react'
  import &quot;../workout/style.css&quot;
  
  const [buttonColor, setButtonColor] = useState()
  
  function Workout() {
  
      let buttonColor = document.getElementsByClassName(&quot;button&quot;)
  
      return (
          &lt;div&gt;
              &lt;div class=&quot;container&quot;&gt;
                  &lt;button className=&quot;button&quot;&gt;BODYWEIGHT&lt;/button&gt;
                  &lt;button className=&quot;button&quot;&gt;BARBELL&lt;/button&gt;
                  &lt;button className=&quot;button&quot;&gt;DUMBELLS&lt;/button&gt;
                  &lt;button className=&quot;button&quot;&gt;KETTLEBELLS&lt;/button&gt;
                  &lt;button className=&quot;button&quot;&gt;STRETCHES&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      )
  }
  
  export default Workout
  </code></pre>