React / redux how to maintain scroll positoin between routes
Asked Answered
P

1

1

Working from the redux real-word example code base here

I noticed that when I scroll down a large list of repositories, that when I then visit a user page and immediately go back that my scroll position in the repositories list is maintained.

However, after I removed the redux DevTools from the Root container I then noticed that my scroll position was no longer maintained.

I'm trying to build a similar react/redux web app where it's important to maintain scroll position.

Can anyone tell me how maintaining scroll position is supposed to work? I thought I read somewhere that react-router has this feature built in but it doesn't seem to be working.

Pointillism answered 19/10, 2016 at 15:0 Comment(0)
A
1

React-router has a middleware which I think is what you are looking for. react-router-scroll

Anatola answered 19/10, 2016 at 15:24 Comment(1)
So react-router did at one point or another handle maintaining scroll position between routes but it was eventually removed and is now handled using the middleware that you've linked to above.Pointillism

© 2022 - 2024 — McMap. All rights reserved.