How to selectively refetch data in a loader based on query params or path changes? #12538
-
Hi, I'm using React Router v6.28.0 and have a route with a loader that makes two fetch calls:
I need listValuesLoader to rerun whenever the query parameters (request) change. How can I achieve this behavior? Can I split the calls in two different loaders? Thanks, |
Beta Was this translation helpful? Give feedback.
Answered by
sergiodxa
Dec 13, 2024
Replies: 1 comment 1 reply
-
There's no way to only fetch part of a loader, there are a few solutions.
I think 1 is better, you can use something like TanStack Query's QueryClient for that. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ArthurGuez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no way to only fetch part of a loader, there are a few solutions.
I think 1 is better, you can use something like TanStack Query's QueryClient for that.