Scroll restoration
See original GitHub issueHello! I’m evaluating this library as an alternative to react-router and it looks quite good!
I’ve looked in the documentation and examples but couldn’t find anything about scroll restoration.
I’ve cloned the examples repository to see if scroll position was restored when navigating back & forward and it seems it does not (tested this by making the Compose
component have 1000px
height).
Perhaps this functionality could live into a plugin, possibly by using https://github.com/taion/scroll-behavior. Thoughts?
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
History.scrollRestoration - Web APIs | MDN
The scrollRestoration property of History interface allows web applications to explicitly set default scroll restoration behavior on history ...
Read more >History API - Scroll restoration - Chrome Developers
scrollRestoration . It takes two string values: auto , which keeps everything as it is today (and is its default value), and manual...
Read more >ScrollRestoration v6.6.1 - React Router
This component will emulate the browser's scroll restoration on location changes after loaders have completed to ensure the scroll position is restored to ......
Read more >Implementing scroll restoration in ecommerce React apps
An advanced tutorial for scroll restoration in React apps, with an example build tailored specifically for ecommerce sites.
Read more >react-scroll-restoration - npm
Support for scroll restoration with React router. Latest version: 1.0.10, last published: 8 months ago. Start using react-scroll-restoration ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I did this with the context API, but yes, it’s similar to any store. For now my API look like this:
And all component should be wrapped in a
<ScrollMemoryProvider />
It works with complex CSSTransition, I’m not sure this is the best place to discuss about it 😃
I’m going to implement this myself for a specific need. If someone has done this before, it would be nice to upload the code here 😃