I had to create a Guest Mode mechanism in React.JS

I had to create a Guest Mode mechanism in React.JS

Introducing

As usual, in all of my previous projects I had to use some auth provider to do the authentication mechanism, but this case would be different, besides the usual case using an auth provider, I’d create a guest mode mechanism.

My Use Case

if you are a logged user you can save a lot of projects into the app, but as a guest user can save only 1 project, also if guest users wants login, his project can be stored on DB.

What solution did I apply?

I choose indexedDB to save all guest users data in the browser, and I counted with Dexie(https://dexie.org/docs/Tutorial/React) to helpe me.
Basically I created a hook to instance my indexedDB, and all of methods like add, update and remove, and then can use it anywhere.

the thing is, all data will be deleted if the user does or programatilly, this is amazing :)))))