ReactJs 入门

第一步:安装node.js
第二步:设置npm的国内镜像,使用淘宝镜像 https://npmmirror.com/

// 方式一:

// 设置仓库镜像地址:
npm config set registry https://registry.npmmirror.com
// 查看配置是否生效:
npm config get registry

// 方式二:
npm install -g cnpm --registry=https://registry.npmmirror.com

第三步: 安装reactJs的手脚架工具包

npm install -g create-react-app

ps:没有安装手脚架工具包会出现错误:

'create-react-app' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

第四步: 官网文档 https://reactjs.org/docs/create-a-new-react-app.html

npx create-react-app my-app
cd my-app
npm start

使用TypeScript模板

npx create-react-app my-app-ts --template typescript

使用yarn包管理工具
tyarn只是使用了淘宝的镜像

npm install yarn tyarn -g
tyarn create react-app my-app-ts --template typescript
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容