#Help to redirect to a specific section
28 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message
@digital adder First before I assume something else, do you actually have an element with id={"banner"?
yes
and when i manualy use /success#banner
it works
Then It's the redirect call.
btw, that ",sections" was a mistake i just tried smthing
i see
It's probably that redirect isn't able to pass query, because it's not trying to fetch, that would be my guess.
alright, thanks man
Is this on the server?
Oh, well if it was on the client you could do:
export default component() {
const router = useRouter()
router.push("/success#banner")
return ([...])
}
@digital adder Is your success page on the client?
Oh that makes it easy
Just have this inside your page
useEffect(() => {
var banner = /* Define your element */
banner.scrollIntoView({behavior: "smooth"})
},[])
So that will automatically scroll to the banner whenever the page loads
just make sure its obviously in the top level of your page, and ofc import useEffect
@slow stump thank you so much!