polemius / recoil-persist

Package for recoil state manager to persist and rehydrate store
https://polemius.dev/recoil-persist/
MIT License
348 stars 40 forks source link

Is it possible to have two tabs open using the same app without overwriting each others state? #34

Closed josoroma-zz closed 3 years ago

josoroma-zz commented 3 years ago

Hi!

I have this app where people needs to have one tab open as a user and another tab open as a admin... So I was wondering if it is possible to have two tabs open using the same application without overwriting the other's state?

Thank you!

polemius commented 3 years ago

Hi,

It is possible in your application to change the key for different user role?

const { persistAtom } = recoilPersist({
  key: isAdmin ? 'recoil-persist-admin' : 'recoil-persist-user',
})
josoroma-zz commented 3 years ago

Thanks a bunch @polemius !