我刚刚启动了ReactJs,我在以下代码的输出中面临问题
<!DOCTYPE html>
<html>
<head>
<title>My first react file</title>
<script src="https://unpkg.com/react@latest/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.js"></script>
</head>
<body>
<div id='react-container'></div>
<script type= "text/babel">
/*
ReactDOM.render(React.createElement('ul', null ,
React.createElement('li', null , 'item 1'),
React.createElement('li', null , 'item 2'),
React.createElement('li', null , 'item 3')),
document.getElementById('react-container'));
*/
ReactDOM.render(
<ul>
<li> item 1 </li>
<li> item 2 </li>
<li> item 3 </li>
</ul>,
document.getElementById('react-container'));
</script>
</body>
</html>
上面的代码没有在浏览器和控制台中产生预期的输出,我收到以下错误:
未捕获的TypeError:无法读取属性&#39;键&#39;未定义的