Created
August 12, 2022 20:31
-
-
Save rs6000/6b5100ee367d11032385ac60f97a67ce to your computer and use it in GitHub Desktop.
Get started React in single file with CDN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- CDN --> | |
<!-- react --> | |
<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> | |
<!-- babel --> | |
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> | |
<title>Hello React</title> | |
</head> | |
<body> | |
<div id="app"> | |
</div> | |
<!-- 程式區 --> | |
<!-- 要使用JSX 要先啟用 babel 加入 type="text/babel" --> | |
<script type="text/babel"> | |
const app = ReactDOM.createRoot(document.getElementById('app')); | |
app.render(<h1>Hello, world!</h1>) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment