Pass the cache key to trigger()
in useSWRMutation
#2827
Unanswered
AhmedBaset
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's imagine we have a form of two inputs (or selects) e.g.
country
andstate
. When the user selects a country we triggeruseSWRMutation
to get the areas of the selected countryThis pattern is not cachable because the
key
is static e.g."states
not e.g."states-USA"
.Is there a way to cache the result in this case? would be better if we could cache the result based on the
args
that's passed totrigger
.One last question, what is the real benefit of having the
key
param required inuseSWRMutation
since the data is not cached, in addition to theargs
passed totrigger
Beta Was this translation helpful? Give feedback.
All reactions