-
I am not sure is it my misunderstanding or not, but in general if I want to fire a request when certain condition is met, how can I do it? My impression of react-query seems like only support fire request when component is loaded. In my case I only want to fire request to backend if condition is met:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
you are talking about |
Beta Was this translation helpful? Give feedback.
you are talking about
useMutation
, right? This returns amutate
function, so the idea is to unconditionally calluseMutation
, this doesn't trigger a request. it gives you amutate
function, and once you invoke this function (can be in a condition), the mutation is started.