redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

RTK-Query render data in one component and fire re-fetch from another one

Open Killen7 opened this issue 1 year ago • 1 comments

Hi, The use case I'm trying to solve is: I have a component A where I use the query hook, and a component B (toaster) with a button that when clicked, I want to trigger the re-fetch of the data rendered in component A. How can I do that?

Killen7 avatar Feb 13 '24 18:02 Killen7

You can use cache tags. Add a specific cache tag to the query used by component A. Then dispatch a manual cache tag invalidation for that tag in component B.

rjgotten avatar Feb 21 '24 21:02 rjgotten