Router with Tanstack Query - Why not useLoaderData ?
If I have a route that looks like this:
Then the recommendation I've seen to get the data in my component is to use
Which means that I need to grab the
userId out of the routes search params again to do so.
Is it possible to just use useLoaderData or something similar so that I don't need to parse the search params again in the component, and instead just use the data I already told the loader to fetch?2 Replies
harsh-harlequin•2y ago
you must use
useQuery or useSuspenseQuery to get all features react-query offersharsh-harlequin•2y ago
React Query meets React Router
React Query and React Router are a match made in heaven.