Skip to content

RTK Query: Toast notification content contingent on multiple PUT responses #2981

Answered by markerikson
nrl240 asked this question in Q&A
Discussion options

You must be logged in to vote

That's definitely not achievable just with RTKQ, because RTKQ is just about the data fetching aspect.

So yes, that's where listeners would come in, and listeners are much more flexible than "a single action" :)

Per https://redux-toolkit.js.org/api/createListenerMiddleware#startlistening , you can provide any one of the four options for deciding when an effect is kicked off:

  • type or actionCreator: an exact match against the action type string
  • matcher: a function that can be any combination of the RTK "matcher" utilities, such as isAnyOf(action1, action2, action3)
  • predicate: any function with a signature of (action, prevState, currentState) => boolean, with arbitrary comparison logic inside

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nrl240
Comment options

Answer selected by nrl240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants