API Connector - data loading animation

I’m trying to build a loading animation while the API is connecting and the data is loading. I know how to do it in a workflow action when I’m fetching data from the API. However, I would like to create a global loader for every API request because I have multiple repeating groups and requests. I’m using reusable components to switch data in the dashboard view, so I tried to create a state on my dashboard, but I’m unable to set this state from the reusable component.

I would appreciate your assistance in resolving this issue.