Next.js Discord

Discord Forum

Persisting data client side across static pages

Gharial posted this in #help-forum
Open in Discord
I'm building a ecommerce app and my pages are pre-rendered using generateStaticParams. I have two pages, an infinite scroll page and a product specific page. I'm trying hard to figure how to "cache" the data in infite scroll, so when you navigate back to it from a product page, you end up where you left.

I initially thought about using a context around the app, but the value of the context is lost when navigating to static pages..

This is the scenario:

1. Scroll far down the infinite scroll page
2. Click on a product page to navigate to it
3. Navigate back in the browser
4. You can keep scrolling where you left of

0 Replies