These docs are old and won’t be updated. Go toreact.dev for the new React docs.
SeeAdd React to an Existing Project for the recommended ways to add React.
Both React and ReactDOM are available over a CDN.
<scriptcrossoriginsrc="https://unpkg.com/react@18/umd/react.development.js"></script><scriptcrossoriginsrc="https://unpkg.com/react-dom@18/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:
<scriptcrossoriginsrc="https://unpkg.com/react@18/umd/react.production.min.js"></script><scriptcrossoriginsrc="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>To load a specific version ofreact andreact-dom, replace18 with the version number.
crossorigin Attribute?If you serve React from a CDN, we recommend to keep thecrossorigin attribute set:
<scriptcrossoriginsrc="..."></script>We also recommend to verify that the CDN you are using sets theAccess-Control-Allow-Origin: * HTTP header:
This enables a bettererror handling experience in React 16 and later.