1,在页面中导入JS
<script src="../js/react.development.js"></script> <script src="../js/react-dom.development.js"></script> <script src="../js/babel.min.js"></script>
2,编码
1 <script type="text/babel"> //必须声明babel,告诉babel.js去解析jsx代码 2 //1,创建虚拟DOM对象 3 var vDom=<h1>Hello World</h1> 4 //2,将虚拟DOM渲染到页面真实容器中 5 ReactDOM.render(vDom,document.getElementById("test")); 6 </script>