title: Filtering data from API using dropdown in React
body: <p>How would I go about filtering results from an API using the dropdown?</p>
  <p>I currently have a select tag like so</p>
  <pre><code>  &lt;select value={selectMonthFilter} onChange={e=&gt; setSelectMonthFilter(e.currentTarget.value)}&gt;
      {console.log(selectMonthFilter)}
      &lt;option value=&quot;&quot;&gt;---&lt;/option&gt;
      &lt;option value=&quot;&quot;&gt;Jan&lt;/option&gt;
      &lt;option value=&quot;&quot;&gt;Feb&lt;/option&gt;
      &lt;option value=&quot;&quot;&gt;Mar&lt;/option&gt;
      ...
    &lt;/select&gt;
  </code></pre>
  <p>The list is also displaying all the results from the API with</p>
  <pre><code>  const [data, setData] = useState([]);
  
    const [selectMonthFilter, setSelectMonthFilter] = useState(data)
  </code></pre>
  <p>Example of what the API returns</p>
  <pre><code>{
  &quot;id&quot;: 1,
  &quot;first_name&quot;: &quot;Bob&quot;,
  &quot;last_name&quot;: &quot;Smith&quot;,
  &quot;birthdate&quot;: &quot;1970-04-19T08:56:27Z&quot;,
  },
  </code></pre>
  <p>Where 1970 is the year, 04 is the month, 19 is the day and the string after is time.</p>
  <p>How would I implement so if the user selects Mar on the dropdown, it filters all the people that have their birthdays in March?</p>
  <p>I tried testing the following but it doesn't seem to select anything</p>
  <pre><code>  const selectMonths = (selectMonthFilter) =&gt; {
      setSelectMonthFilter(selectMonthFilter)
      console.log(selectMonthFilter)
    };
  
  &lt;select value={selectMonthFilter} onChange={event =&gt; selectMonths(event.target.value)} &gt;
  </code></pre>
  <p><a href="https://codesandbox.io/s/api-test-c4swl?file=/src/pages/home.jsx" rel="nofollow noreferrer">https://codesandbox.io/s/api-test-c4swl?file=/src/pages/home.jsx</a></p>