How to use isValidating in multiple SWR calls within a single component #2745
Unanswered
hughesthatgirl
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
Uh oh!
There was an error while loading. Please reload this page.
-
Issue: I have a dashboard component that shows open and completed orders. I have to call two different endpoints (one for getting the open orders and one for getting the completed orders). I would like to use
isValidating
to check the state of both API responses and show a loading animation in the UI for each section of the dashboard ifisValidating
is true.My question is, how do you use
isValidating
in multiple SWR calls within a single functional component?What is shown below obviously does not work because you can't re-declare a const. I have not come across any examples in the SWR docs of using
isValidating
with multiple calls within the same component.You can also see/answer this question on stack overflow: https://stackoverflow.com/questions/76886562/how-to-use-isvalidating-in-multiple-swr-calls-in-the-same-component
Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions