# How To Use CDN Link In React

**URL:** <https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766>\
**Category:** General\
**Created:** [December 10, 2018, 12:48am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766 "2018-12-10T00:48:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fighder](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@fighder](https://forum.freecodecamp.org/u/fighder)\
**Post date:** [December 10, 2018, 12:48am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/1 "2018-12-10T00:48:49Z")

</div>

I am starting on the front end projects, and I am setting up a React environment locally. I was wondering how I can use the CDN link for testing the project in a react set up since tags don’t seem to work.

---

<div class="post-metadata">

**Author:** ![vaidotasp](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/vaidotasp/32/22304_2.png) [@vaidotasp](https://forum.freecodecamp.org/u/vaidotasp)\
**Post date:** [December 10, 2018, 1:38am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/2 "2018-12-10T01:38:49Z")

</div>

I am assuming here that you just want to experiment with React a little bit by adding some `<script>` tags and creating a component?  
These will add React, ReactDOM and JSX to start with:

```auto
    <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>

```

Then to create a component in your script file, follow normal React way of creating a component.

```auto
const domElement = document.querySelector(".myawesomecontainer");
const e = React.createElement;

class Box extends React.Component {
........
........
ReactDOM.render(<Box />, domElement)

```

Hope it helps.

References:

> **[Add React to a Website – React](https://reactjs.org/docs/add-react-to-a-website.html)**
>
> A JavaScript library for building user interfaces

---

<div class="post-metadata">

**Author:** ![fighder](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@fighder](https://forum.freecodecamp.org/u/fighder)\
**Post date:** [December 10, 2018, 1:44am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/3 "2018-12-10T01:44:27Z")

</div>

Oh I meant like using this CDN link: [https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js](https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js)  
Like how you can throw that in the body in html to get the little drop down, but it doesn’t seem to work when I throw it into the render of the component.

---

<div class="post-metadata">

**Author:** ![Gigusek](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@Gigusek](https://forum.freecodecamp.org/u/Gigusek)\
**Post date:** [December 10, 2018, 1:54am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/4 "2018-12-10T01:54:35Z")

</div>

Just add the link (within script tags) in your main .html file.

---

<div class="post-metadata">

**Author:** ![fighder](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@fighder](https://forum.freecodecamp.org/u/fighder)\
**Post date:** [December 10, 2018, 2:49am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/5 "2018-12-10T02:49:52Z")

</div>

But I am rendering things in React JS, can I connect the html file to react somehow?

---

<div class="post-metadata">

**Author:** ![IBP](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ibp/32/132924_2.png) [@IBP](https://forum.freecodecamp.org/u/IBP)\
**Post date:** [January 22, 2019, 6:06pm UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/6 "2019-01-22T18:06:42Z")

</div>

Look in your ‘public/index.html’ file. you can add the link there.  
Hope this helps!

 ![react](https://global.discourse-cdn.com/freecodecamp/original/3X/3/9/39668178e9b7dcdc348e75d92892408beb59b779.jpeg)

---

<div class="post-metadata">

**Author:** ![NikicaCh](https://avatars.discourse-cdn.com/v4/letter/n/b3f665/32.png) [@NikicaCh](https://forum.freecodecamp.org/u/NikicaCh)\
**Post date:** [July 22, 2019, 9:31am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/7 "2019-07-22T09:31:34Z")

</div>

Yeah it helps, you can add CDN links there

---

<div class="post-metadata">

**Author:** ![natalieolivo](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/natalieolivo/32/325652_2.png) [@natalieolivo](https://forum.freecodecamp.org/u/natalieolivo)\
**Post date:** [September 19, 2019, 3:37pm UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/8 "2019-09-19T15:37:14Z")

</div>

One important thing to remember is to add `type="text/babel"` to the script tag if you are writing inline JavaScript. Otherwise the browser will complain (even with babel included) when it tries to parse html in your script.

---

<div class="post-metadata">

**Author:** ![fridavbg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/fridavbg/32/132728_2.png) [@fridavbg](https://forum.freecodecamp.org/u/fridavbg)\
**Post date:** [January 31, 2020, 4:32pm UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/9 "2020-01-31T16:32:12Z")

</div>

Hey!

Im not getting the CDN link to work if someone could help me out ?

Ive created my React app with npx create-react-app.

I tried to add the CDN link in the index.html (both with script tags and without), within the head tags

```auto
 <link>
      href="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"
</link>

```

but the test box is not at all showing up in my browser. .

Really grateful for some help

---

<div class="post-metadata">

**Author:** ![A\_Town0789](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/a_town0789/32/94732_2.png) [@A\_Town0789](https://forum.freecodecamp.org/u/A_Town0789)\
**Post date:** [April 25, 2020, 2:38pm UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/11 "2020-04-25T14:38:58Z")

</div>

I have pasted this all over my html.index, app.js, index.js and I still am not able to get it to render to my React app.

I used the boilerplate npx create-react-app to get started on my local machine, and it is on localhost:3000 if that makes any difference.

Please advise, because I have no other ideas of where to put the script

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 11:27am UTC](https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766/12 "2021-01-16T11:27:37Z")

</div>

Closed on January 16, 2021, 11:27am UTC


