React(三):Hello,React

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>helloReact</title>
    <script src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>

    <!-- Don't use this in production: -->
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>

<body>
    <!-- 准备一个容器 -->
    <div id="test"></div>
</body>

<!-- 这里一定要用babel,因为写的时jsx -->
<script type="text/babel">

// 创建虚拟DOM
const vDom = <div>Hello,React</div>
//react渲染
ReactDOM.render(vDom, document.getElementById("test"))
</script>

</html>

 

posted @ 2023-07-30 13:44  谁知道水烫不烫  阅读(6)  评论(0编辑  收藏  举报