Files
react.dev/content/docs/cdn-links.md
Alex 7fafb9f916 Break out Installation into top-level doc section (#452)
* Break out Installation into top-level doc section

* Update navigation (prev/next, nav tree)

- Move Installation section to top
- Add next/prev to install pages

* add links to other install options from try react page

* fix markdown link

* Clarify that Quick Start and Install are optional "next steps"

* Add top-level CDN page

This is useful for Codepen and other Unpkg-y setups

* Add link to Tutorial from Try React

* Update CRA link in tutorial

* Make Try React subheader a proper sentence

* Add "minimal"

* Explain local dev setup is more work than Codepen etc

* Fix typos

* Add : between headings

* add note that CRA is not lightweight

* fix typo

* Update add-react-to-a-new-app.md

* Update add-react-to-a-new-app.md

* Remove the Bower note

* Update try-react.md

* Tweak wording

* Use direct link
2017-12-23 15:37:23 +00:00

38 lines
1.4 KiB
Markdown

---
id: cdn-links
title: CDN Links
permalink: docs/cdn-links.html
prev: add-react-to-an-existing-app.html
next: hello-world.html
---
The UMD builds of React and ReactDOM are available over a CDN.
```html
<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>
```
The versions above are only meant for development, and are not suitable for production. Minified and optimized production versions of React are available at:
```html
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
```
To load a specific version of `react` and `react-dom`, replace `16` with the version number.
### Why the `crossorigin` Attribute?
If you serve React from a CDN, we recommend to keep the [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) attribute set:
```html
<script crossorigin src="..."></script>
```
We also recommend to verify that the CDN you are using sets the `Access-Control-Allow-Origin: *` HTTP header:
![Access-Control-Allow-Origin: *](../images/docs/cdn-cors-header.png)
This enables a better [error handling experience](/blog/2017/07/26/error-handling-in-react-16.html) in React 16 and later.