How to switch from LocalStorage to SessionStorage for atomWithStorage #1220
-
The documentation doesn't mention how to change to SessionStorage. |
Beta Was this translation helpful? Give feedback.
Answered by
dai-shi
Jun 9, 2022
Replies: 1 comment
-
import { atomWithStorage, createJSONStorage } from 'jotai/utils'
const storage = createJSONStorage(() => sessionStorage)
const someAtom = atomWithStorage('some-key', someInitialValue, storage) Yeah, we should have this in docs. #805 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
TwistedMinda
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Yeah, we should have this in docs. #805