![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
redux
本宝宝很开心
做一名合格的搬运工
展开
-
redux 中间件异步操作的用法(二)
为什么需要中间件Action提交后,Reducer会立即计算出State,如果在Dispatch一个Action后,到达Reducer之前需要进行一些其他的操作,这时候就需要用到中间件,在实际工作中你可以使用中间件来进行日志记录、创建崩溃报告,调用异步接口或者路由等等安装redux-thunk后引入import { createStore, applyMiddleware, compose } from 'redux'import reducer from "./reducer"import th原创 2021-06-07 20:10:10 · 91 阅读 · 1 评论 -
redux的基本用法(入门一)
1.storestore保存数据的地方,可以看成一个容器,整个应用只能拥有一个storeRedux提供createStore函数用来生成storeimport { createStore } from 'redux';import reducer from './reducer'const store = createStore(reducer );//createStore函数接受另一个函数作为参数,返回新生成的store对象2.State一个 State 对应一个 View,通过与用户原创 2021-03-31 10:33:36 · 159 阅读 · 0 评论