Chong Lip Phang
Chong Lip Phang

Reputation: 9279

What is an intercepting route in Next.js?

After reading the official documentation, I still didn't understand Next.js intercepting routes.

Given: enter image description here

My questions:

  1. When we navigate to /photo/id1, do both page.js files get rendered?
  2. When we navigate to /feed/photo/id1, do both page.js files get rendered?
  3. Do both files get rendered if we don't use a parallel route?
  4. Will we ever need to intercept routes without using parallel routes?
  5. Why can't we just conditionally render the modal within /photo/[id]/page.js, using URL '? parameters' and importing a template perhaps?
  6. Are we supposed to specify the layout of both page.js files in layout.js?

A StackBlitz experiment can be found here.

Upvotes: 0

Views: 208

Answers (0)

Related Questions