在首次对应用程序进行初始化之前显示加载图标 [英] Show loading icon before first react app initialization
本文介绍了在首次对应用程序进行初始化之前显示加载图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在浏览器下载所有js文件并加载应用程序之前,显示加载器图标的标准方式是什么.
What is the standard way of showing a loader icon before browser downloads all js files and loads react application.
我可以做这样的事情而不会破坏任何东西吗?
Can I do something like this without breaking anything?
<div id="content" class="app">
Loading...
</div>
推荐答案
是.
一旦您的JavaScript加载完毕,您可以通过将您的react应用渲染到相同的<div>
Once your javascript has loaded, you can replace Loading...
by rendering your react app into the same <div>
render(
<App />,
document.getElementById('content')
);
这篇关于在首次对应用程序进行初始化之前显示加载图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文