Push params to url without page scrolling to top

I have a route that looks like this:
<Route path="/:page_type?/:page_url?" component={Page} />
<Route path="/:page_type?/:page_url?" component={Page} />
When page_type and page_url is available, a popup appears. But when the url changes, the page scrolls to the top. How do I avoid that? I've tried:
<A href="/album/the_album_url">View album</A>
<A href="/album/the_album_url">View album</A>
<div onClick={() => navigate("/album/the_album_url")}>View album</div>
<div onClick={() => navigate("/album/the_album_url")}>View album</div>
3 Replies
andahendriksen
andahendriksenOP4mo ago
I thought it might have been the popup that made the page scroll, but removing the popup still makes the page scroll to the top. I can see though that when the url changes, the page does not run again.
Alex Lohr
Alex Lohr4mo ago
A has a noScroll prop.
andahendriksen
andahendriksenOP4mo ago
Awesomeness! That's super easy haha thank you so much
Want results from more Discord servers?
Add your server