0
我想在使用ReactDOM渲染方法的主html文件上渲染一个简单的div,但div并没有渲染在屏幕上,也没有抛出任何异常。我做错了吗?ReactDOM不渲染一个简单的div
app.js:
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1> Hi! </h1>, document.getElementById('root')
);
的index.html:
<!doctype html>
<html>
<head>
<title>Example</title>
</head>
<body>
<h1> Hello World! </h1>
<div id="root"></div>
</body>
</html>
屏幕只能显示的 “Hello World!” h1标签。
我也使用webpack webpack开发服务器和Babel。
您还没有''中index.html' app.js'文件 –