Skip to content

partial hydration with useHydrateAtom #2603

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

You must be logged in to vote

an untidy task

Hm, so is it a DX issue? I'd create a function to initialize the atom value.

const createComplexAtomValue = (number3, ssr_ed_setence) => (
      {
        numbers: {
          number1: 1,
          number2: 2,
          number3,
        },
        stenences: {
          sentence1: 'sentence1',
          sentence2: 'sentence2',
          sentence3: 'sentence3',
          sentence4: 'sentence4',
          sentence5: 'sentence5',
          ssr_ed_sentence,
        },
      },
);

const complexAtom = atom(createComplexAtomValue('default number', 'default sentence');

I fixed it with having granular atoms.

Sounds like it's more Jotai way.

If something like this would be poss…

Replies: 1 comment 5 replies

Comment options

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

@dai-shi
Comment options

@aryankarim
Comment options

@dai-shi
Comment options

Answer selected by aryankarim
@aryankarim
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