In plain words
Browser storage, such as localStorage and cookies, lets your app keep small bits of data on the visitor's device so they survive a refresh.
Where you see it
In DevTools, open Application, then Local Storage: you may find Quill's dark-mode setting, a half-written draft, or a Supabase sign-in entry whose name starts with sb-. It lives in that one browser and nowhere else.
What goes wrong
- Treating localStorage as the database
Notes saved only in localStorage vanish when Maya switches to her phone or clears her browser. Anything that matters belongs on the server.
- Trusting what's stored there
Anyone at the keyboard, and any script on the page, can read and change localStorage. A stored isAdmin flag should never make someone an admin.
localStorage.setItem("isAdmin", "true"); - Reading it during server rendering
localStorage exists only in the browser. Next.js code that touches it while rendering on the server fails with "localStorage is not defined".
What to tell your agent
Quick check
Sign in to earn +10 XP for itMaya's Quill notes show on her laptop but not on her phone, though she's signed in on both. Why?