βοΈ Introduction
Finally, I have a chance to continue my Redux blog series. If you haven't read it, I suggested to read the first blog fi...
For further actions, you may consider blocking this person and/or reporting abuse
Thank you so much for this. Will there be content introducing error handling while using mutation with RTK query?
I tried to log the result inside a useEffect like below but the result.isSuccess and result.isError is always being false, even when the data is created and invalidated successfully. What could be the issue?
const [createAlbum, result] = useCreateAlbumMutation()
useEffect(() => {
console.log(result)
}, [result]);
Hi @yanwongpyw , thank you for your comment.
Are you trying to make the isError to be true? I think you can try to update the URL of the mutation to be the wrong URL, I believe the error handling will be working.
Also if you are using RTK Query you don't need to use UseEffect for checking the data. RTK Query has their own dev tool.
github.com/reduxjs/redux-devtools
You can check the status from there.
Tnks its very useful and best then RTK Query docs.
Great job , best description about rtk query.
Thank you Ray, I'm handling the error state, now I'm kinda find some idea to hack :)
Good blog Ray. We will except more on RTK query
Thanks for the content. Great Job Sir!
Following your tutorial, I am trying to use RTK Query to in todo application. However, an error pops up anytime I import the RTK Query's auto-generated hook into a component.
which step is it? I'm not sure if I can debug from this error.
Great job! I will just left here a quick fix to do.
When you mentioned "We can also make the parameter to be an object and use a spread operator to access the attribute easily". I think what you would like to say is "destructuring assignment" instead of "spread operator" (in regards the below snippet)
Again, good job!
Thank you @eduardoklein . Good catch. Appreciate your feedback.
Can someone explain me more about the tags ? invalidate tags, provided tags etc
Hey sorry for late response. the purpose of tags is to validate the data. Because we are getting caching data in RTK Query rather than fetching to API all the time.
Provided Tags initializes the tag name when we need to invalidate the data.
Invalidate Tags will trigger the tag name is provided.
We will use
provided tags
in Query, and invalidateinvalidate tags
in mutation.What about authorization token and refresh token, How can we handle that ?
Hey @ray do you have any idea about testing this RTK query in Jest ,
how do we mock the api calls in it ?
Thanks for the great explanation, itβs very helpful ππ©π»βπ»
how to add multiple reducers along with multiple middleware in a store when using RTK query?
needHelp
Thank you for your insightful explanation on RTK Query, Ray. Your knowledge-sharing is greatly appreciated.
(1). How to store all API call responses in redux store?
(2). How to set authorization token common in header for all API?
(3). How add new middleware in store for new createdApi?
Thank you for sharing. I'm learning a about rtk.