CDN Script Tags: React Without Build Tools
What you'll learn: How to use React immediately in the browser without any installation or build step.
The Simplest Way to Try React
You can load React directly from a CDN (Content Delivery Network) by adding <script> tags to an HTML file. This is like checking out a library book instead of buying it — quick to start, but with limitations.
<!DOCTYPE html>
<html>
<head>
<title>React via CDN</title>
</head>
<body>
<div id="root"></div>
<!-- Load React and ReactDOM from CDN -->
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script>
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(React.createElement('h1', null, 'Hello from CDN React!'));
</script>
</body>
</html>
What You're Missing
Without build tools, you cannot use:
- JSX syntax (that friendly HTML-like code)
- Import/export statements for organizing code
- npm packages beyond what's available via CDN
- Hot Module Replacement for instant updates
- Code splitting or optimization
You're writing raw React.createElement() calls, which becomes unwieldy fast.
When to Use This Approach
Perfect for:
- Quick experiments or learning the absolute basics
- Adding a single interactive widget to an existing static page
- Demonstrating concepts without setup friction
Key Takeaway: CDN script tags let you use React instantly in any HTML file, but you lose JSX, modern imports, and the entire development experience that build tools provide — fine for prototypes, impractical for real applications.