10 Navigation
This chapter covers
- Understanding routing as coordination between the URL, the browser, the server, and the application.
- Designing friendly, shareable route paths.
- Supporting deep links from the server.
- Intercepting navigations with modern APIs and History API fallbacks.
- Matching routes with URLPattern fallbacks.
Unless we are talking about a single document web app, most projects will involve different screens, views, pages or however you want to call the ability to render different content for different use cases in the same web app. This is where navigation comes in place and where routing makes it possible.
Navigation is the ability to move between those different screens and the router is an object with the ability to detect user’s expectation on what should be rendered at one particular moment of the web app and matches that expectation (expressed in the URL as a route) to a view, page, document or screen. Navigation and routing is usually introduced as a client-side concern: change the URL, render a view, move on. In real web projects, routing is broader than that, involving different navigation techniques.