Can i send props in NextJs 14 router?
Unanswered
Little yellow ant posted this in #help-forum
Little yellow antOP
I'm using useRouter() from next/navigation for navigatting. Is there any way i can send props with route name? Like if i'm going from list page to single page, so i don't need to call the api on single screen if i already have data.
1 Reply
while useRouter is done via client-side navigation, every navigation still makes a call to the server every so often.
You can store your data in a layout context so that when traversing from /a to /b, it will not be rerendered and have layout still be there with the old state.
You can store your data in a layout context so that when traversing from /a to /b, it will not be rerendered and have layout still be there with the old state.