Maison > Questions et réponses > le corps du texte
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="js/react.js"></script>
<script src="js/react-dom.js"></script>
</head>
<body>
<p id="example"></p>
<script type="text/babel">
ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('example') );
</script>
</body>
</html>
PHPz2017-04-11 13:17:17
你缺少了babel解析器,详细看http://reactjs.cn/react/docs/...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<script src="build/react.js"></script>
<script src="build/react-dom.js"></script>
<script src="https://npmcdn.com/babel-core@5.8.38/browser.min.js"></script>
</head>
<body>
<p id="example"></p>
<script type="text/babel">
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);
</script>
</body>
</html>
大家讲道理2017-04-11 13:17:17
缺少Browser.js ,需要将JSX转化成javascript
不懂的话看https://github.com/ruanyf/rea... 就明白了