Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (2018) First Steps in React Add React to a Project

Brendan Layton
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Layton
Front End Web Development Techdegree Graduate 19,956 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>