Skip to content

atomWithStorage returns null after app reload despite being saved in local storage in my Vite React app #2958

Answered by dai-shi
nivethan-me asked this question in Q&A
Discussion options

You must be logged in to vote
export const accessTokenAtom = atomWithStorage<string | null>(
  'accessToken',
  null,
  undefined,
  { getOnInit: true },
);

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nivethan-me
Comment options

@dai-shi
Comment options

Answer selected by nivethan-me
@nivethan-me
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants