Replies: 1 comment 4 replies
-
Well, you want to "cache" that as long as you want to display it on the same page. RTK will by default clean out mutation results after the component triggering them unmounts or triggers a new mutation. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Guys,
I'm very new to RTK and RTKQ, but i've been using thunk and saga for a while now.
I am very confused with the use case of RTKQ for form submissions
the docs mentioned:
Does this mean that it is only designed for data fetching? I reckon we can use mutation for posting stuff for form data, however what's the need for caching for that? I'm confused if I should use
createAsyncThunk
again for my forms or just stick to RTKQ. However I feel like creating 1createAPI({})
is the best practice recommended here.Can anyone please help explain to me?
Thanks
Edit:
There's an example provided already in the docs!! I should have read it. Thanks for the great docs
https://redux-toolkit.js.org/rtk-query/usage/mutations
Beta Was this translation helpful? Give feedback.
All reactions