avoid page scroll when router.replace
Answered
Sweat bee posted this in #help-forum
Sweat beeOP
How can I avoid the page to scroll up to the top when I use router.replace? I only add query params and dont need the page to scroll up. Its even really bad for user experience in this cas!
Answered by Shar Pei
Nextjs Doc:
router.replace(href: string, { scroll: boolean }): Perform a client-side navigation to the provided route without adding a new entry into the browser’s history stack.2 Replies
Shar Pei
Nextjs Doc:
router.replace(href: string, { scroll: boolean }): Perform a client-side navigation to the provided route without adding a new entry into the browser’s history stack.Answer
Shar Pei
There is a scroll param