Showing a route's content in the current layout (e.g. modals).
Skip to solutionKEEP THE
hardFrontend
What are intercepting routes in Next.js and what are they used for?
271 views
01
Understand the problem
nextjsintercepting-routesmodalsrouting
02
Attempt it yourself
Sketch your approach before reading the solution — that's what interviews test.
Nudge consolestandby
Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.
03
Study the solution
Intercepting routes (the (.) / (..) conventions) let you load a route within the current page's context instead of a full navigation — classically to show a photo/detail in a modal while keeping the URL shareable, falling back to the full page on reload.
Solution ready — 2 min read
Classified // press E to declassify
04
Read the code
Photo modal via interception + slot
app/
feed/page.tsx # list of photos
photo/[id]/page.tsx # full standalone page (reload/direct)
@modal/
(.)photo/[id]/page.tsx # intercepts soft-nav → render as modal
default.tsx # renders nothing when no modal
# Clicking a photo opens the modal (URL = /photo/123); reload shows the full page.05
Join the discussion
Discussion (0)
Sign in to join the discussion.
No responses yet. Be the first to share what you think.
Transmission complete // awaiting log
KEEP THE
STREAK ALIVE.
Dossier 89 of 95 decoded in the Next.js track. One more won't hurt.