title: How to show a random element of an json object from localhost?
body: <p>I wish to show a random quote from a local database every time I reload the page. I'm fetching the data from localhost:3000 using custom useFetch hook but all I've ever did was map trough the entire object and show every element; now I only need to show one element and make it random. This is my attempt:</p>
  <pre><code>const Header = () =&gt; {
      const { data } = useFetch('http://localhost:3000/Quotes')
  
      const quotes = data.map(quote =&gt; ({ quote }))
      const quote = quotes[Math.floor(Math.random() * quotes.length)]
      
    return (
      &lt;div className='header'&gt;
                  &lt;div className='quothe'&gt;
                      &lt;h2 key={quote.id}&gt;{quote.title}&lt;/h2&gt;
                      &lt;h3 key={quote.id}&gt;- {quote.author}&lt;/h3&gt;                   
                  &lt;/div&gt;
      &lt;/div&gt;
    )
  }
  </code></pre>