-
Notifications
You must be signed in to change notification settings - Fork 1
Navigation
Oleksii Nazarenko edited this page Aug 30, 2024
·
2 revisions
There are 2 types of handling navigation in the project: default browser navigation and smooth navigation.
The key difference between them is that the smooth nav doesn't reload the page and only updates page state.
This type of navigation is used as a fallback for smooth navigation. For example, when navigating from folder page to some html file or some other website.
Use HTML anchor tag or use this to programmatically navigate
import { redirect } from "@src/features/router/"
redirect()
Introduced to prevent page flash and to make navigation experience much smoother.
It fetches page in background and updates local PageStateContext
with information about the page. Alternatively it will fall back to default browser navigation if page does not support smooth nav.
import useSmoothRouter from "@src/features/router/useSmoothRouter"
const { navigateToPage } = useSmoothRouter()
navigateToPage(href)