<!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>
标签:react,const,render,React,Hello,vDom From: https://www.cnblogs.com/jmsstudy/p/17591353.html