I have a component and need to wait for the component to mount properly. Until then, I would like to show a loading animation. How could I do this in React?
I would like to do this without state, as I have many stateless components that will need that kind of functionality. Is there any efficient way to do this? If not, how would I do this with state? Have a variable isLoading
and then in componentDidMount
set the variable to false and have a conditional rendering in my render()
?