<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rahul Kumar</title>
    <description>The latest articles on DEV Community by Rahul Kumar (@rahulkumarhavitmsi).</description>
    <link>https://dev.to/rahulkumarhavitmsi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1649173%2Fc42e664a-bb0e-4b23-bb82-403b9a3c0df6.jpg</url>
      <title>DEV Community: Rahul Kumar</title>
      <link>https://dev.to/rahulkumarhavitmsi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahulkumarhavitmsi"/>
    <language>en</language>
    <item>
      <title>Next.js Caching Issues With Fetching Data</title>
      <dc:creator>Rahul Kumar</dc:creator>
      <pubDate>Sun, 28 Jul 2024 15:03:44 +0000</pubDate>
      <link>https://dev.to/rahulkumarhavitmsi/nextjs-caching-issues-with-fetching-data-180a</link>
      <guid>https://dev.to/rahulkumarhavitmsi/nextjs-caching-issues-with-fetching-data-180a</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Common caching issue in Next.js while building a application is default caching behaviour of Next.js that leads to frustration for so many developer. In so many case the caching helping to speed up page loads and reduce server load by storing copies of resources. &lt;br&gt;
However, it can sometimes lead to outdated content displayed, which can be problematic for dynamic application like blog feed where new blog displayed when added.&lt;/p&gt;
&lt;h2&gt;
  
  
  Opting out of Data Caching
&lt;/h2&gt;

&lt;p&gt;Next.js extends the native Web fetch() API to allow each request on the server to set its own persistent caching semantics.&lt;/p&gt;

&lt;p&gt;To opt out of caching for individual fetch requests, you can set the cache option in &lt;code&gt;fetch&lt;/code&gt; to &lt;code&gt;'no-store'&lt;/code&gt;. This will fetch data dynamically, on every request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default async function Page() {

  const dynamicData = await fetch(`https://...`, { cache: 'no-store' })
  const data = await dynamicData.json()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will help override the default caching behaviour of Next.js&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>caching</category>
      <category>javascript</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
