React page resumes scrolling

problem description

The

A page has a long list with many items. Clicking on an item will jump to the B page to view the details, and then return to the A page and then pull the data to render again. At this time, the A page goes back to the top, so it is very embarrassing. I have slipped down the long list on page A, and I have to find the one I looked at before. so the question is, how to record the scrolling position before leaving page A?. Then, after returning to page A, restore the scroll position

try

at first it was supposed to be stored in redux, but what if there are a lot of pages that need to record where to scroll? Give up.
then thought of routing hooks, but routerv4 didn"t.
then. This is it.

clipboard.png

I don"t have a clue right now. I hope I can give you some direction. It"s best not to introduce other packages

.
Apr.16,2021

routerRedux.goBack ()
can't this


sessionStorage learn

Menu