react-query with suspense vs react-router loader #5944
Unanswered
jestrickler
asked this question in
Q&A
Replies: 1 comment 3 replies
-
I was able to play around with the 2nd half of this, with lazy loading a component containing a query with keepPreviousData and suspense. It seems to work pretty nice, showing the Suspense fallback while fetching the component and the first page of data, then staying in the component (no Suspense fallback) when fetching additional pages. I guess I could see with a loader it might fetch the component and data in parallel..? I'll have to try that out. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any important distinction between using react-query with suspense and wrapping the Route's element in a Suspense block versus using a loader (to preload the react-query cache)? In my mind, they seem to accomplish the same thing. Does lazy loading make any difference? I'm assuming it would display the Suspense fallback while lazy loading and getting data from useQuery with suspense..?
Beta Was this translation helpful? Give feedback.
All reactions