Client side navigation in next.js
Unanswered
Common paper wasp posted this in #help-forum
Common paper waspOP
Hi.
I wonder is it possible to have client side navigation (or snap and fast navigation) instead of waiting for server to respond?
I want to have SPA like. I can do routing using state but I also want to track current page (meaning after refresh, i dont want to go back to main page) and also dont want to use localstorage to save the latest page that user was on.
I wonder is it possible to have client side navigation (or snap and fast navigation) instead of waiting for server to respond?
I want to have SPA like. I can do routing using state but I also want to track current page (meaning after refresh, i dont want to go back to main page) and also dont want to use localstorage to save the latest page that user was on.
5 Replies
Short mackerel
You have the router of next/navigation. the navigation itself keeps a history of the visited pages
this is the reason why we are still using the pages router
afaik the app router will always require a network request on client side navigation if you need to fetch data during ssr
afaik the app router will always require a network request on client side navigation if you need to fetch data during ssr
Dutch Smoushond
theo wanted something similar in his t3-chat, he added react router in his next app
[video](https://www.youtube.com/watch?v=bIr7NtNRDmE)
[video](https://www.youtube.com/watch?v=bIr7NtNRDmE)
Common paper waspOP
Yeah either i have to use react router in nextjs or just use parama in url to handle page state
Kinda suck.
I love nextjs api routes but i also want the client side navigation ☹️
I love nextjs api routes but i also want the client side navigation ☹️