How To Keep Component State Across Pages in Next.js

Using the session storage & useLayoutEffect

Published on

Enjoyed this article?

Share it with your network to help others discover it

Continue Learning

Discover more articles on similar topics

Next.js Middleware: How it Works and 5 Real Use Cases

Since v. 12.0.0 (stable from 12.2.0), Next.js added Middleware. Middleware (as it is in many other frameworks) is a way to intercept the user's request before it reaches the actual page. Put simply…

Nextjs

How to Use Environment Variables in Next.js

Take a look at how to use environment variables in Next.js.

NextjsEnvironment-variablesReact

Dodging the Vercel Tax: How to use an open-source alternative for Serverless Postgres, Redis, and Blob Storage

Find out how to get the same DX wins of Vercel Storage by using its Postgres, Redis, and Blob providers with WunderGraph - a free and open-source technology without the Vercel markup, and without vendor lock-in to boot.

ReactNextjsStorage

I Built a Serverless Live Chat App with Next.js, Fauna, and WunderGraph for GraphQL Live Queries

A step-by-step guide to creating a scalable, real-time chat app using Serverless technologies, with a little help from NextAuth.js for GitHub sign-ins. Who needs WebSockets when you've got Live Queries?"

NextjsWundergraphFauna

Building a Modern SaaS Dashboard with Saas UI and Next.js App Router

Dashboards are essential for every SaaS app, and UI libraries do help you build them fast, but Emotion.js-based libraries are problematic in Next.js 13. Let's look at how Saas UI can help.

NextjsReactNext app router

How To Solve Hydration Error In Next.js

Today, let’s talk about hydration error that often occurs in Next.js. Most of us used Next.js must be familiar with the following error: The reason for the error has been clearly stated in the error…

JavaScriptNextjsWeb Development