如何创建一个 react web demo
全局安装 create-react-app
npm install -g create-react-app
创建 my-app 工程
create-react-app my-app
进入 my-app 文件夹,安装依赖
cd my-app
npm install
启动开发环境
npm run start
编译为浏览器可以识别的格式,生成 build 目录
npm run build
进入 build 目录, 安装 静态服务器
cd build
npm install -g http-server
启动静态服务器
cd build
http-server -o ./
工程代码见:
https://github.com/qyzhizi/js-logical/tree/main/react-app-demo