Skip to content

Can I consume react context from atomFamily ? #1855

Answered by stevebeauge
stevebeauge asked this question in Q&A
Discussion options

You must be logged in to vote

Years later, my architecture has changed a lot.
What I learned is that jotai is not the good candidate for a centralized store which mixes client and server state (my services are essentially a facade to query apis).

Today, I use a mix of tanstack react query for data fetching (server side state), and jotai or zustand for client side state (filters, selection, etc.)
When some data requires to assemble both worlds (processing complex rules against server data and user input), I create some custom hook that consume server state, client state and return a derived state ready to be used.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@carlosbensant
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by stevebeauge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants