Check out example codes for "conditional script tag in html head site:stackoverflow.com". It will help you in understanding the concepts better.
Code Example 1
<script>window.jQuery || document.write('<script src="js/vendor/jquery-{{JQUERY_VERSION}}.min.js"><\/script>')</script>
Learn ReactJs, React Native from akashmittal.com