新建第一个 React 工程

2022-08-21  本文已影响0人  jancywen
  1. 安装node、npm

官网下载 LTS 版本点击安装,npm 会和node 一并安装

~ % node -v
v16.17.0
~ % npm -v
8.15.0
  1. Create React App
    下面三种方法三选一
npx create-react-app my-app
npm init react-app my-app
yarn create react-app my-app
  npx create-react-app my-app

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

第一次执行会提醒 安装 create-react-app@5.0.1 直接 yes 安装即可

上一篇 下一篇

猜你喜欢

热点阅读