Skip to content
Discussion options

You must be logged in to vote

Internally, it would just delegate to useQuery or useSuspenseQuery.

Why wouldn’t you build that in user-land? Note that calling a query conditionally depending on a boolean param is against the rules of hooks in react, but you can maybe build it on top of useBaseQuery.

The split between useQuery and useSuspenseQuery is a fantastic design choice.

Thanks, but we’re actually re-considering it given how react and use() work right now 😅. One idea is to have:

const { promise } = useQuery(...)

and then have users do:

const data = use(promise)

wherever they want, even conditionally, to suspend. It’s already available but needs an experimental flag (experimental_prefetchInRender) turned on.

M…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by toothlessdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants