Compose atoms with server data sync. #3006
Unanswered
RodolfoSilva
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@dai-shi do you have any advice? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's the best way to derive two atom lists to only re-render an individual list of items?
I'm using Jotai with React Query. Initially, I was storing the server-fetched list as individual atoms and then including a property called isSelected. However, every time React Query refetches, I lose the previously selected item.
I was wondering if it would be possible to use three atoms: one to store the selected items, another to store the list of items, and a derived atom to combine the two. The goal is to ensure that only the relevant item re-renders when it is updated or selected.
Beta Was this translation helpful? Give feedback.
All reactions