多行html建議用()包裹
阿新 • • 發佈:2018-11-20
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app"></div>
<script src="./node_modules/@babel/standalone/babel.min.js"></script>
<script src="./node_modules/react/umd/react.development.js" ></script>
<script src="./node_modules/react-dom/umd/react-dom.development.js"></script>
<script type="text/babel">
// const getMessage = () => "hello world";
// console.log(getMessage());
// const element = <h1>hello world</h1>;
// const element = (<div>
// <h1>hello world</h1>
// <p>react</p>
// </div>);
// function getTitle() {
// return (<div>
// <h1>hello world</h1>
// <p>react</p>
// </div>);
// }
function getTitle() {
return (
<div>
<h1>hello world</h1>
<p>react</p>
</div>);
}
const element = getTitle();
ReactDOM.render(element, document.getElementById('app'));
</script>
</body>
</html>