title: getServerSideProps vs fetching directly in React
body: <p>I am getting a bit confused with the getServerSideProps of NextJS.</p>
  <p>In the docs you can find this explanation.</p>
  <blockquote>
  <p>For example, suppose that your page needs to pre-render frequently
  updated data (fetched from an external API). You can write
  getServerSideProps which fetches this data and passes it to Page</p>
  </blockquote>
  <p>My confusing is why would you use getServerSideProps if you could simply fetch the data every x sec in your React component itself (after getting the initials data via getStaticProps).</p>
  <p>Is there an advantage of using getServerSideProps over just the React way ?</p>
  <p>so like this for example :</p>
  <pre><code> useEffect(() =&gt; {
      const interval=setInterval(()=&gt;{
        const fetchdata = async () =&gt; {
          const res = await fetch(&quot;url&quot;)
          const data = await res.json()
          setsongs(data)
        }
        fetchdata()
       },15000)
       return()=&gt;clearInterval(interval)
    }, [])
  </code></pre>