DEV Community

Discussion on: Next.js E-Commerce Tutorial: SPA Example

Collapse
 
pierreguillaumelaurin profile image
Pierre-Guillaume Laurin

Hi Mohd! You can setup a custom App component just like we did in Step 2 of this tutorial (integrating components), except you can add your state hooks to it.

Other solutions you might want to explore include shallow routing that enables you to change the URL without fetching data again! Some npm modules I haven't had the chance to try are also starting to be developed if you want to look into this.

If you try any of these solutions, please let me know how it goes!

Collapse
 
mohdahmad1 profile image
Mohd Ahmad

I found it, it is already present in next js. It does not work in dev environment where getStaticProps runs on each request