E
E
Evgeny Skuridin2015-03-16 20:28:16
React
Evgeny Skuridin, 2015-03-16 20:28:16

How to show spinner while rendering react.js components?

React renders static components with a delay, albeit a very small one. The question is how to beautifully implement a single loading spinner for all, which will work with both static components and those that climb, for example, into firebase? The first thing that came to my mind was to write in getInitialState loading: true in each component, and then change it in componentDidMount. But I don't like having to repeat this code in every component. Is there a way to do this elegantly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Agarkov, 2015-03-17
@ElianL

If some logic is repeated in different components, then it can be moved to mixins.
Article on habré

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question