Home > Mobile >  How does Neetcode persist checkbox count / progress bar without sign-in and without local storage?
How does Neetcode persist checkbox count / progress bar without sign-in and without local storage?

Time:02-01

I'm on www.neetcode.io, and I realized that it saves my progress. However, when I check my local storage, I don't see any state. I also haven't signed in, so there is no "state" of mine saved in some db that the site fetches. Does anyone know how the state is persisted on re-visit / refresh?

CodePudding user response:

It is using local storage. Tick a checkbox, then open a console and type localStorage["completed-problem-list"].

localStorage["completed-problem-list"]
// Output:
> '{"Arrays & Hashing":["https://leetcode.com/problems/contains-duplicate/"]}'

You can also check local storage by tabbing over to the "Application" tab of Chrome Dev Tools, then click the dropdown menu next to "Local Storage" (not the item itself, which is arguably confusing), then "https://neetcode.io/".

  • Related