#history objects

Navi interacts with the browser history through a history object, created by the history package. Each app should have exactly one history object, which can be accessed through your navigation object’s history property.

You’ll mainly use this object for programmatic navigation. In particular, it’s push() and replace() allow you to change the current URL, and thus cause a change in the current route.

// Push a URL onto the browser history
history.push(path, state?)

// Replace the current URL
history.replace(path, state?)

To access the History object within a React application, you can use the <NavHistory> component.

#External histories

The history package that create’s Navi’s history object is exactly the same package used by react-router. This makes it possible to use both Navi and react-router in the same project — just pass react-router’s history to the history option of createBrowserNavigation()

#Further reading

The react-router documentation goes into further detail on the history object.