<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>App-Router on David Lang</title>
    <link>https://www.davidlang.tech/tags/app-router/</link>
    <description>Recent content in App-Router on David Lang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 10 Jun 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.davidlang.tech/tags/app-router/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Next.js App Router: Complete Migration Guide</title>
      <link>https://www.davidlang.tech/posts/nextjs-app-router-complete-migration-guide/</link>
      <pubDate>Mon, 10 Jun 2024 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/nextjs-app-router-complete-migration-guide/</guid>
      <description>&lt;p&gt;Migrating from Pages Router to App Router unlocks RSC, layouts, and improved data fetching-but requires deliberate planning.&lt;/p&gt;&#xA;&lt;h2 id=&#34;folder-structure&#34;&gt;Folder Structure&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;app/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  layout.tsx      # Root layout&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  page.tsx        # /&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  blog/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [slug]/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      page.tsx    # /blog/:slug&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  api/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    hello/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      route.ts    # Route Handlers&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;data-fetching&#34;&gt;Data Fetching&lt;/h2&gt;&#xA;&lt;p&gt;Replace &lt;code&gt;getServerSideProps&lt;/code&gt; with async Server Components. Replace &lt;code&gt;getStaticProps&lt;/code&gt; with &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;revalidate&lt;/code&gt; options. Client data still uses SWR or React Query in Client Components.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
