Skip to content
Discussion options

You must be logged in to vote

This looks wrong. useHydrateAtoms should be used under the <Provider> tree.
And you shouldn't pass store={store} prop, otherwise it can be shared across sessions.

export const JotaiProvider = ({
  children,
  initialValue,
  dangerouslyForceHydrate,
}: {
  children: React.ReactNode;
  initialValue: string;
  dangerouslyForceHydrate?: boolean;
}) => {
  useHydrateAtoms([[currencyAtom, initialValue]], {
    store,
    dangerouslyForceHydrate,
  });
  return <Provider store={store}>{children}</Provider>;

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@schardev
Comment options

@dai-shi
Comment options

@schardev
Comment options

@schardev
Comment options

@dai-shi
Comment options

Answer selected by schardev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants