Next.js Discord

Discord Forum

router.replace(`/#${name}`)

Answered
Austrian Black and Tan Hound posted this in #help-forum
Open in Discord
Austrian Black and Tan HoundOP
not scrolling after being on a different path
Answered by DirtyCajunRice | AppDir
currently anchors only work within the same page
View full answer

7 Replies

Austrian Black and Tan HoundOP
assume I am on test/slug
when i do router.replace(/#${name})
it becomes test/#name
it goes to that page
but it doesnt scroll
currently anchors only work within the same page
Answer
@DirtyCajunRice | AppDir currently anchors only work within the same page
Austrian Black and Tan HoundOP
any workarounds?
@Austrian Black and Tan Hound any workarounds?
you could probably do some manual JS scrolling in a useEffect. not sure it is worth it though