@fighder (Nelson) posted a new topic, subject "How To Use CDN Link In React". It read:

   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.
      *[IMO]: in my opinion

To which @vaidotasp (Vaidotasp) replied

    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:
    [code] 
            <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>
        
    [/code]
    
    Then to create a component in your script file, follow normal React way of creating a component.
    [code] 
        const domElement = document.querySelector(".myawesomecontainer");
        const e = React.createElement;
        
        class Box extends React.Component {
        ........
        ........
        ReactDOM.render(<Box />, domElement)
        
    [/code]
    
    Hope it helps.
    
    References:  
    reactjs.org
    
    ### Add React to a Website – React
    
    A JavaScript library for building user interfaces
      *[IMO]: in my opinion

So @fighder (Nelson) replied

    Oh I meant like using this CDN link: 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.
      *[IMO]: in my opinion

After which, @Gigusek added

    Just add the link (within script tags) in your main .html file.
      *[IMO]: in my opinion

@fighder (Nelson) replied

    But I am rendering things in React JS, can I connect the html file to react somehow?
      *[IMO]: in my opinion

So @IBP (Oca) replied

    Look in your ‘public/index.html' file. you can add the link there.  
    Hope this helps!
    
    react1594×862 68.4 KB
      *[IMO]: in my opinion

To which @NikicaCh (Nikica Maksimovski) replied

    Yeah it helps, you can add CDN links there
      *[IMO]: in my opinion

To which @natalieolivo (Natalie) replied

    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.
      *[IMO]: in my opinion

Then @fridavbg (Frida) said

    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
    [code] 
         <link>
              href="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"
        </link>
        
    [/code]
    
    but the test box is not at all showing up in my browser. .
    
    Really grateful for some help
      *[IMO]: in my opinion

So @RandellDawson (Randell Dawson) replied

    It is not a link element. It is a script element.
      *[IMO]: in my opinion

After which, @A_Town0789 (Anthony) added

    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
      *[IMO]: in my opinion

To which @ilenia (Ilenia) replied

    *[IMO]: in my opinion


{'source': 'discourse', 'url': 'https://forum.freecodecamp.org/t/how-to-use-cdn-link-in-react/244766', 'title': 'How To Use CDN Link In React', 'views': 30868, 'has_accepted_answer': False, 'word_count': 485, 'like_count': 5, 'reply_count': 6, 'participant_count': 9, 'posts': 12, 'tags': '', 'author': '@fighder (Nelson)', 'participants': '@fighder (Nelson), @vaidotasp (Vaidotasp), @Gigusek, @IBP (Oca), @NikicaCh (Nikica Maksimovski), @natalieolivo (Natalie), @fridavbg (Frida), @RandellDawson (Randell Dawson), @A_Town0789 (Anthony), @ilenia (Ilenia)', 'image_url': [None], 'created_at': '2018-12-10T00:48:49.009Z', 'last_posted_at': '2021-01-16T11:27:37.511Z'}