I am thinking of creating a React component called LoadingMask where I can show or not (depending on the state) the load mask from any component. The idea shows it before calling ajax and hides it after receiving the data.
I don’t want to display two masks at the same time, so if one component makes a request and the other creates another request, I want to add 1 to my “MaskCounter” and subtract it when the request is finished. If the counter is 0, I need to hide the LoadMask.
I want to do this, I think I need to create a "Singleton" component that I can use on the entire platform, so there is only one download. I also do not find it pleasant to send events to hide / show the mask for all components.
Any ideas?
source
share