美文网首页
新建第一个 React 工程

新建第一个 React 工程

作者: jancywen | 来源:发表于2022-08-21 17:09 被阅读0次
    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 安装即可

    相关文章

      网友评论

          本文标题:新建第一个 React 工程

          本文链接:https://www.haomeiwen.com/subject/ubvvgrtx.html