Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

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>
like image 788
nha Avatar asked Feb 17 '26 01:02

nha


1 Answers

Note: I would rather comment this but I do not possess 50+ reputation.


You can place your scripts in your index.html file before you load your react bundle.
like image 106
Monstrum Avatar answered Feb 18 '26 15:02

Monstrum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!