JavaScript React Basics First Steps in React Add React to a Project

Brendan Layton
Brendan Layton
Front End Web Development Techdegree Graduate 19,953 Points

CORS error when using localhost

I've setup a local http server following the instructions provided, however I'm receiving the following CORS error in the console:

Access to script at 'https://unpkg.com/react-dom@16.7.0/umd/react-dom.development.js' (redirected from 'https://unpkg.com/react-dom@16/umd/react-dom.development.js') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

How do I get around this?

I'm having the same issue as well! But try this, it seems to be working for me so far. I apologize in advance if this doesn't work for you.

 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.1.0/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.1.0/umd/react-dom.development.js"></script>

2 Answers

That's awesome! One more thing I forgot to add was the link for Babel. Here it is if you need it.

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>