I have a global loader element. The loader spins when the app performs any network operation. I recently integrated with Apollo Client but I am not entirely sure entirely the best approach for examining whether Apollo is currently fetching.
According to the docs, there is a loading
property that is passed along with data as props to the component using the graphql
HOC. The problem is that my loader exists on the top most level in a component that does not utilize the graphql
HOC.
The way I see it, I will probably need to examine the state
object to see when a query exists with loading
set to true. Is this a sound approach?
Here is what my data looks like for reference:
Another alternative I can think of is to perform the query on my parent component.
For reference, I am using Apollo Client in a React-Redux environment.