Skip to content
nav-router

Examples / Data and loading

Back and forward

Each page counts how many times its data loaded. Going back shows what was there, without loading it again.

Try this

  1. Open One, Two and Three. Each says its data loaded once.
  2. Press back twice, then forward. The counts stay at 1: each page comes back from its history entry.
  3. Click One in the page. That’s a new navigation, so it loads again and says 2.
app/

Starting…

How it works

A route’s result rides on its history entry. When you go back or forward, the router shows what that entry already had, so data doesn’t run again and the counter doesn’t move. Following a link to the same page is a new navigation, so it loads afresh.