RTK Query: Is it possible to handle isLoading of different endpoints centrally? #4330
Unanswered
FurkanCodes
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Well, what you could do is use a
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In RTK Query, I have two mutations that fire up different endpoints;
On my component,I use these two different methods on two different button clicks and I need to pass isLoading state to a component I have which renders a loader;
<Loader blocked={isLoading}fullScreen />
I access the loader states as this;
<Loader blocked={isSendByIdLoading || isFetchByIdLoading} fullScreen />
This actually makes Loader appear onthe screen,but am I actually suppose to handle loading states for each and every mutation I use inside a component? Is there any functionality that centralizes this? Or am I completely misusing this?
I am thinking about setting the state of isLoading for each button click to reduxstore then use that state for the Loader component.
Beta Was this translation helpful? Give feedback.
All reactions