What are the differences between refetch and invalidateQueries?
Hi, It is understood that invalidateQueries invalidates queries and active queries are reacquired in the background.
When is refetch used?
2 Replies
stormy-gold•3y ago
Invalidating queries just marks them as stale, so they'll be rerun if there are active observers for the query. Refetch will always rerun the query, even if there are no components subscribed to the data.
wise-whiteOP•3y ago
@ergusto
Thanks!
>Refetch will always rerun the query, even if there are no components subscribed to the data.
Does that mean it will fetch even if the query is not in an active state?🤔