Skip to content

React-query and support for useQueries #643

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

You must be logged in to vote

I assumed useQueries is provided in RQ to avoid violating the rules of hooks.
Jotai atoms don't have such rules, so we can compose atoms.

const queryAtom1 = atomWithQuery(...)
const queryAtom2 = atomWithQuery(...)
const queriesAtom = atom((get) => [get(queryAtom1), get(queryAtom2)]) // or whatever shape. can make it writable too.

This feels more minimalistic.
Does this fill your needs?
(I'm not strongly against providing atomWithQueries, if it gives better DX.)

cc @aulneau

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@IanDuncanson
Comment options

@aulneau
Comment options

aulneau Aug 8, 2021
Collaborator

@IanDuncanson
Comment options

@aulneau
Comment options

aulneau Aug 8, 2021
Collaborator

Answer selected by IanDuncanson
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