The useNavigation Hook has the following signature:
const navigation = useNavigation()
It returns the navigation object of Navi, which contains the following functions to manage the navigation state of the app:
- extractState(): Returns the current value of window.history.state; this is useful when dealing with server-side rendering.
- getCurrentValue() : Returns the Route object that corresponds to the current URL.
- getRoute(): Returns a promise to the fully loaded Route object that corresponds to the current URL. The promise will only resolve once the Route object is fully loaded.
- goBack(): Goes back one page; this is similar to how pressing the back button of the browser works.
- navigate(url, options): Navigates to the ...