The React Show

A podcast focused on React, programming in general, and the intersection of programming and the rest of the world. Come join us on this journey.

Listen

[23] Better Routing in React with NextJS

Do you find React Router cumbersome or tedious to work with sometimes? Or are you just curious how routing could be done better? In this episode we take a look at how routing is done in NextJS. We discuss...


Do you find React Router cumbersome or tedious to work with sometimes? Or are you just curious how routing could be done better? In this episode we take a look at how routing is done in NextJS. We discuss what it looks like and how to use it. And we also offer our opinions on the NextJS routing mechanism itself.

Show Notes

  • Intro
  • Overview
  • What is routing? What are routes?
    • routing is choosing which component to render for a given path and in nextjs,  or API routes
    • relevant multi-page apps
  • Before Nextjs
    • vanilla react
    • react router
    • how to create routes
  • With Nextjs
    • pages/routeName.js
    • nesting
  • Dynamic Routes
    • blog
    • using getServerSideProps to load slug [slug].js from sanity
    • getServerSideProps Redirect example
  • Opinions on: file based data-store / framework / NextJS
  • Api Routes
    • api folder
    • dynamic routes
      • auth0 library
  • Summary
  • Outro

Support the show