T
TanStack8mo ago
ugly-tan

Testing react query useSuspenseQuery hook

I am trying to test useSuspenseQuery hook independently without any components. I followed the blog post here to test useQuery and it doesn't work for SuspenseQuery if I add error state or isLoading state https://tkdodo.eu/blog/testing-react-query
Testing React Query
Let's take a look at how to efficiently test custom useQuery hooks and components using them.
1 Reply
magic-amber
magic-amber8mo ago
My understanding is that useSuspense query has niether of those states. That is why when you use useSuspenseQuery the data is always inferred and not possible to be undefined.

Did you find this page helpful?