怎么在线编写但页面react实例代码

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>

<div id="example"></div>
<script type="text/babel">

在这里可以写react代码

例如:

ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);

表示,我们把<h1>Hello, world!</h1>这个标签挂载到id="example"的</div>上面

</script>

</body>
</html>

posted @ 2019-12-31 11:46  渡一/渡一  阅读(452)  评论(0)    收藏  举报