美文网首页
react 环境搭建

react 环境搭建

作者: 諍眼閉眼 | 来源:发表于2021-07-10 20:46 被阅读0次
// -S 即 --save  对应在 dependencies,这个则是需要发布到生产环境中的,就比如你要跑一个基于vue的项目,所以需要vue.js来支持,而这个vue.js文件就需要跟随项目到最终的生产环境
// -D 即 --save-dev 对应在 devDependencies ,是我们开发的时候需要用到的一些包,只需要用于开发阶段,真正打包上线的时候并不需要这些包,因为这些工具只是你用来打包代码的,是用来识别特定文件以及代码,帮助我们生产最终文件的

// tips : 啥也不写   npm i 初始化都后都找不到包的

// 安装创建react项目
cnpm install -g create-react-app
create-react-app my-app

// sass
// 最新版本node直接运行    老版本 按对应的sass版本来
cnpm install  node-sass -D

// router
cnpm install react-router-dom -S

// 全局状态管理  redux react-redux
cnpm install redux react-redux -S
// redux 开发工具  
// 1.安装google插件  
// 2.安装npm包
cnpm install redux redux-devtools-extension -D
// 3.store中进行配置
import {composeWithDevTools} from 'redux-devtools-extension'
const store = createStore(allReducer,composeWithDevTools(applyMiddleware(thunk)))

// 组件通讯 pubsub-js
cnpm install pubsub-js -S


 


sass 对应 node 版本

image.png

相关文章

网友评论

      本文标题:react 环境搭建

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