简体   繁体   English

React.js从远程CDN插入脚本标记

[英]React.js insert script tag from remote CDN

I would like to insert scripts into the header of my page (or at least they have to be loaded before the render method of my component is called). 我想将脚本插入到我的页面的标题中(或者至少必须在调用我的组件的render方法之前加载它们)。

The scripts in question are from here if it matters : 如果重要的话,有问题的脚本来自这里

<!-- jQuery -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>

<!-- Firebase -->
<script src='https://cdn.firebase.com/js/client/2.0.2/firebase.js'></script>

<!-- Firechat -->
<link rel='stylesheet' href='https://cdn.firebase.com/libs/firechat/2.0.1/firechat.min.css' />
<script src='https://cdn.firebase.com/libs/firechat/2.0.1/firechat.min.js'></script>

Note: I would rather comment this but I do not possess 50+ reputation. 注意:我宁愿对此发表评论,但我不具备50多个声誉。


You can place your scripts in your index.html file before you load your react bundle. 您可以在加载react bundle之前将脚本放在index.html文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM