摘要: redux-sage 是什么? 如何使用 redux-saga ? redux-sage 是什么? redux-saga 是一个用于管理 redux 异步操作的中间件,将所有的异步操作统一在一个saga文件中进行处理,这也是redux-saga对比redux-thunk的优势之一; 如何使用 red 阅读全文
posted @ 2021-10-12 22:42 琪寂 阅读(328) 评论(0) 推荐(0)
摘要: redux-thunk 是什么? redux-thunk 用于处理中间件的异步方法,内部通过action类型是否为funtion来判断当前传递的action是同步还是异步,如果是异步方法,redux-thunk直接调用此方法并传入store的dispatch和getState 方法 redux-th 阅读全文
posted @ 2021-10-10 15:59 琪寂 阅读(161) 评论(0) 推荐(0)
摘要: logger.js export default store => next => action => { console.log(action) next(action) } test.js export default store => next => action => { console.l 阅读全文
posted @ 2021-10-10 14:04 琪寂 阅读(52) 评论(0) 推荐(0)
摘要: Redux API 作用 createStore 用于创建一个store对象 bindActionCreators 用于简化操作,不用开发者手动触发dispatch React-redux API 作用 Provider Provider用于包裹根组件,使所有被包裹的组件都能通过connect访问s 阅读全文
posted @ 2021-10-03 21:27 琪寂 阅读(262) 评论(0) 推荐(0)