Both React and ReactDOM are available over a CDN:
<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:
<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>
--- Babel: https://babeljs.io/docs/en/babel-standalone
https://unpkg.com/@babel/standalone/babel.min.js
Ví dụ:
<!DOCTYPE html>
<html>
<head>
<title>React js demo</title>
</head>
<body>
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
<script type="text/javascript" src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<div id="root"></div>
<script type="text/babel">
ReactDOM.render(
<h2>HELLO WORLD!</h2>,document.getElementById("root"));
</script>
</body>
</html>
Không có nhận xét nào:
Đăng nhận xét