MENU
Intercepting Routes
With names preceded by (.), intercepting routes prevent the other non-intercepting routes from getting rendered during a hyperlink navigation.
Intercepting Routes are often combined with Parallel Routes to effectively create modals. This approach addresses several common challenges when building modals, such as:
- Making the modal content shareable via a URL.
- Preserving the modal context upon page refresh, preventing the modal from closing.
- Ensuring the modal closes on backward navigation, rather than reverting to the previous route.
- Allowing the modal to reopen on forward navigation.
When you click the link, the parallel routes /app/login and /app/@menu/login are not displayed because they have been intercepted by /app/@modal/(.)login and /app/@status/(.)login.
If you enter [domain]/login directly in the address bar, the non-intercepting routes such as /app/login are used instead.
If you enter [domain]/login directly in the address bar, the non-intercepting routes such as /app/login are used instead.
You can also use:
- (..) to match route segments (not the file system) one level above.
- (..)(..) to match route segments (not the file system) two levels above.
- (...) to match route segments (not the file system) from the root app directory.