Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Really simple thing, if a URL parameter changes, previous data is no longer valid and should be cleared. However, when calling refetch from useEffect, useQuery doesn't do that.
refetch
useEffect
useQuery
Is there some parameter I should pass or something else?
queryKey
You can achieved this by invalidating the query. From the official docs:
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
useQuerychanges you shouldn't need to callrefetchat all. Batching/fetching/caching is normally handled automatically.useQuery?queryKeyand now it works like you described.