9 Client-side routing

This chapter covers

  • “Manual” routing
  • Hash routing
  • Using the page.js library for routing
  • Other routing options

Client-side routing is the ability to navigate between the pages of a web application. There are many things that can trigger a route change:

  • The user clicks a link or button.

  • The application programmatically changes the route based on the current state of the app.

  • The user manually modifies the URL in the browser’s address bar.

Sapper, which builds on Svelte, provides a routing solution that is generally easier to use than adding routing to a Svelte app. This approach will be covered in chapters 15 and 16.

If you do not wish to use the other features that Sapper provides, or you wish to use a different ...

Get Svelte and Sapper in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.