Next.js · Senior · Question 43 of 75
How does the URL-preserving modal pattern work in the App Router?
- ✓Correct answer: An
@modalslot, an(.)photo/[id]interception anddefault.tsx - 2Modal state in Context and a manual
history.pushState - 3A separate
/modalroute opened inside an<iframe>
Explanation
On client navigation, the interceptor renders content in the modal slot over the current page; the URL reflects the open item, and the link can be shared. On direct access, the full page opens. Closing is router.back(). default.tsx guarantees an empty slot when the modal isn't active.