RTK Query: Do we have a manual fetch function that follows cache rules as auto-fetch do #1776
-
I have check the refetch function and trigger function from useQuery and useLazyQuery. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
@xiaoyangfeng I'm not sure I understand what you're asking for here. Can you give a more detailed example? |
Beta Was this translation helpful? Give feedback.
-
You can do that by doing const request = dispatch(
api.endpoints.myEndpoint.initiate(arg, {
forceRefetch: 30,
})
)
// make sure to call this before your component unmounts or the data will never be removed from the cache
request.unsubscribe() |
Beta Was this translation helpful? Give feedback.
You can do that by doing