Categories
JavaScript Answers

How to import a JavaScript package from a CDN or script tag in React?

Spread the love

To import a JavaScript package from a CDN or script tag in React, we get the library from window.

For instance, we write

<script src="https://cdn.dwolla.com/1/dwolla.js"></script>

to add the dwolla library with a script element.

Then we get the dwolla library with

const dwolla = window.dwolla;

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *