Examples
Small apps you can run and edit right here. Each one shows one thing the router does, with a few things to try in the preview.
Start
Data and loading
Loading states
Three routes load at three speeds, so you can watch
holdCommit,loadingDelayandloadingMindecide what you see.Try Open Fast. The URL and the page change together: the data was ready inside
holdCommit.Back and forward
Each page counts how many times its data loaded. Going back shows what was there, without loading it again.
Try Open One, Two and Three. Each says its data loaded once.
Not found
A route with nothing behind its param, and a path no route matches, both end on the not-found view with the URL left as typed.
Try Click Zed. The URL stays
/people/zedand the not-found view shows in the page’s place.
Params and guards
Query params
A task list filtered by a typed query param, with a toggle that changes the query in place.
Try Click Done, then All. The URL’s
?status=changes and the list follows.Guards and sign-in
A settings page only an admin may open. Signed out, the router sends you to sign in; signed in as a member, it refuses.
Try Signed out, open Settings. The guard refuses before the URL moves, and you land on Sign in with the page you wanted as
returnTo.