RTKQ - How can I always fetch on first render? #3007
-
Hello, Right now I have an endpoint defined with Why's that? How can I make sure that on every first render, that the request will be made? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@LoyalPotato : that's one of the main purposes of RTKQ - to reuse cached data without having to re-fetch it every time. If you really want to refetch when a different component mounts, use the |
Beta Was this translation helpful? Give feedback.
@LoyalPotato : that's one of the main purposes of RTKQ - to reuse cached data without having to re-fetch it every time.
If you really want to refetch when a different component mounts, use the
refetchOnMountOrArgChange
in eithercreateApi
or the hook call itself.