NextJS App Router Intro and Tour

Dan Ott - Aug 9 '23 - - Dev Community

Next.js recently released their new App Router, which introduces an entirely new paradigm for creating Next.js apps. As part of Virtual Coffee's Lunch & Learn series, I gave a two-part presentation where we dove in to how the App Router works.

In Part 1, we cover some JS history, and then dive in to the new App Router. We also spent some time on React Server Components.

In Part 2, we take a look at data fetching in the App Router, and ways Next.js can help optimize your app with little work on your end.

You'll find some value here whether you're experienced with Next.js already or have never touched it - it's a great tool and the ways that it hooks in to both the React ecosystem and the Javascript/Typescript ecosystem as a whole offers a lot to learn.

I created a companion GitHub repository that contains examples. The talk is broken up into sections - and each section has a corresponding Pull Request.

The main branch has the full thing, each Pull Request is based off of the other, starting with the Base Install.

See the full running app here on Vercel

Resources

Talk Sections:

0: Base install

(branch only, no PR)

We start with the output of npx create-next-app@latest, with a couple small adjustments

  • Update design
  • Use pnpm

1: Intro, Routes and Layouts

Running App on Vercel

2: Route Groups and Dynamic Routes

Running App on Vercel

3: Handling Errors

Running App on Vercel

4: Data Fetching

Running App on Vercel

5: Suspense

Running App on Vercel

6: Rendering and Caching

Running App on Vercel

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .