-
I was reading the
I was wondering if there was any examples of these alternative solutions that caused a flicker. In my case, the flicker wouldn't be much of an issue because it is just prefilling some form data and in theory the flicker would just cause the inputs to start as blank but then be prefilled so I was interested in trying out the alternative solution to be able to keep the form using SSR. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There's an undocumented option import { atomWithStorage, createJSONStorage } from 'jotai/utils'
const storage = createJSONStorage(() => localStorage)
storage.delayInit = true
const const darkModeAtom = atomWithStorage('darkMode', false, storage) |
Beta Was this translation helpful? Give feedback.
There's an undocumented option
delayInit
instorage
.If we enable it, it will use
initialValue
for the first render and then re-render with stored value.