React / redux how to maintain scroll positoin between routes

一笑奈何 提交于 2019-12-13 12:40:57

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/40135087/react-redux-how-to-maintain-scroll-positoin-between-routes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!