React 17.0.1 安装
使用cnpm安装react
$ cnpm install -g create-react-app
$ create-react-app react-learning
$ cd react-learning
$ npm start
在启动项目时我遇到了一个问题
./src/reportWebVitals.js
Module not found: Can't resolve 'web-vitals' in 'E:\练习\react-learning\src'
原因是缺少web-vitals模块,使用命令 npm install web-vitals --save
安装即可
尝试修改index.html和index.js文件
<div id="example"></div>
const element = <h1>hello world !!!</h1>
ReactDOM.render(
element,
document.getElementById("example")
)