Reputation: 175
I'm using RTK Query in my app. I have some filters on a page. I want to keep them in store so that if I leave page and come back they would stay the same. So when user changes them in select dropdowns app dispatches some reducer's action.
How can I subscribe to those filters changed and make RTK Query after filters have been changed? So it would be subsription to changes of some slice's piece of state, which would trigger rtk query request
Upvotes: 0
Views: 586
Reputation: 44276
You mean like this?
const filterValueFromStore = useSelector(state => state.foo.bar)
const result = useSomeQuery({ someFilter: filterValueFromStore })
Upvotes: 1