title: Data in array items not being displayed on the screen in React
body: <p>I'm making a simple React app where I am getting a list of cars through useEffect hook and then mapping through each one to display them on the screen. Then, I have one button whose purpose would be to sort the cars based on their horsepower. So, when clicking on that button the user would see only the cars whose horsepower is greater than for example 700.</p>
  <pre><code>
  import React, { useState, useEffect } from &quot;react&quot;;
  import &quot;./style.css&quot;;
  
  export default function App() {
  
    const [items, setItems] = useState([])
    const [yo, setYo] = useState(false)
    
  useEffect(() =&gt; {
      fetch(&quot;https://private-anon-af560a53c6-carsapi1.apiary-mock.com/cars&quot;)
        .then(res =&gt; res.json())
        .then(data =&gt; {
          setItems(data)
        })
    }, [])
  
  
    function reverse(){
      items.reverse();
      setItems([...items])
    }
  
    function sortHigherHP(){
      let cars = items.filter(item =&gt; {
        return item.horsepower &gt;= 700;
      }).map(i =&gt; {
        return(
          &lt;div key={Math.floor(Math.random()*10000)} style={{border: &quot;1px solid black&quot;, margin: &quot;10px&quot;, padding: &quot;5px&quot;}}&gt;
              &lt;p&gt;Make: {i.make}&lt;/p&gt;
              &lt;p&gt;Horsepower: {i.horsepower} HS&lt;/p&gt;
            &lt;/div&gt;
        )
      });
      setItems(cars)
    }
  
    function hey(){
      setYo(!yo)
    }  
  
    return (
      &lt;div&gt;
        &lt;h1&gt;React Search &amp;amp; Filter&lt;/h1&gt;
        &lt;div&gt;
          &lt;h3 onClick={hey}&gt;Sort&lt;/h3&gt;
          &lt;div className={yo ? &quot;show&quot; : &quot;hide&quot;}&gt;Sorting options
            &lt;button onClick={reverse}&gt;Reverse Order&lt;/button&gt;
            &lt;button onClick={sortHigherHP}&gt;Higher Horsepower&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        {items.slice(0, 50).map(a =&gt; {
          return (
            &lt;div key={Math.floor(Math.random()*10000)} style={{border: &quot;1px solid black&quot;, margin: &quot;10px&quot;, padding: &quot;5px&quot;}}&gt;
              &lt;p&gt;Make: {a.make}&lt;/p&gt;
              &lt;p&gt;Horsepower: {a.horsepower} HS&lt;/p&gt;
            &lt;/div&gt;
          )
        })}
      &lt;/div&gt;
    );
  }
  
  </code></pre>
  <p>The reverse event handler is obviously working since the reverse method just reverses the array, without changing the original array. But this filter method returns a new array and I have problems here on how to actually display data on the screen. Could the problem be in the .map method that comes right after .filter()?</p>