随笔分类 -  redux

摘要:onClick(e) { e.preventDefault(); const { user, pass } = this.refs; this.props.dispatch(login(user.value, pass.value)); } export const login = (user, p 阅读全文
posted @ 2019-10-23 18:46 zzfx 阅读(131) 评论(0) 推荐(0) 编辑
摘要:介绍 正常redux流程 加入redux-saga之后的流程 使用方式 import { createStore, applyMiddleware } from 'redux' import createSagaMiddleware from 'redux-saga' //引入saga文件 impo 阅读全文
posted @ 2019-10-23 18:04 zzfx 阅读(580) 评论(0) 推荐(0) 编辑
摘要:redux的本质是一套行为解释系统。 首先构建解释系统; 然后使用解释系统对行为进行解释,进而完成对store和状态的维护。 阅读全文
posted @ 2019-10-22 11:05 zzfx 阅读(183) 评论(0) 推荐(0) 编辑
摘要:JS异步编程 (2) - Promise、Generator、async/await https://www.cnblogs.com/learninpro/p/9271813.html http://www.ruanyifeng.com/blog/2015/05/async.html 阅读全文
posted @ 2019-07-17 23:29 zzfx 阅读(171) 评论(0) 推荐(0) 编辑
摘要:redux = monand + pipeline + highorder componet + decouple + middleware redex = store based + event handler redux = function managers redux = 状态处理的流程管理 阅读全文
posted @ 2019-07-12 15:09 zzfx 阅读(232) 评论(0) 推荐(0) 编辑
摘要:要素: 1、高阶函数:reduce; 2、处理函数:reducer; 3、数据:可以是具体数据、签名相同的普通函数、签名相同的高阶函数; reduce(reducer, datas(data or funciton), initResult(optional)) 一、平凡数据处理 1 In [5]: 阅读全文
posted @ 2019-07-12 15:07 zzfx 阅读(265) 评论(0) 推荐(0) 编辑
摘要:let newStore = applyMiddleware(mid1, mid2, mid3, ...)(createStore)(reducer, null); 给({ getState, dispatch }) => next => action签名的函数组分步赋值并进行串联的过程; 整体上是 阅读全文
posted @ 2019-07-12 12:37 zzfx 阅读(190) 评论(0) 推荐(0) 编辑
摘要:将UI组件抽象为状态处理机。分为普通状态和副作用状态。 一、综述 useState:处理函数只改变引用的状态本身;副作用状态:会对引用状态以外的状态和变量进行修改;useReducer:用解藕化的机制进行计算状态维护; 二、useState useState:flux化管理的模块状态(本模块持有)c 阅读全文
posted @ 2019-06-27 11:35 zzfx 阅读(343) 评论(0) 推荐(0) 编辑
摘要:redux是全局状态(数据)的管理机制,局部数据没有意义 阅读全文
posted @ 2019-06-25 16:42 zzfx 阅读(416) 评论(0) 推荐(0) 编辑
摘要:目录 为何而写 redux是什么 redux的设计哲学 redux的工作流 redux的几个核心要素 store action reducer actionCreator combineReducers redux中间件 小结 目录 为何而写 redux是什么 redux的设计哲学 redux的工作 阅读全文
posted @ 2019-06-12 19:38 zzfx 阅读(259) 评论(0) 推荐(0) 编辑
摘要:基于flux和reduce的通信和状态管理机制; 和数据库管理系统一样,redux是一个状态管理系统(或机制)。 const store = createStore( reducer, compose( applyMiddleware(thunk), DevTools.instrument() ) 阅读全文
posted @ 2019-06-12 19:36 zzfx 阅读(337) 评论(0) 推荐(0) 编辑
摘要:This is a post that tries to explain the the basics of Redux. We’ll build a minimal working example with Redux. If you’re looking for proper Redux doc 阅读全文
posted @ 2019-06-12 18:32 zzfx 阅读(444) 评论(0) 推荐(0) 编辑
摘要:Also these are really nice (from http://slides.com/jenyaterpil/redux-from-twitter-hype-to-production#/): Basic Flow Side Effects Side Effects with API 阅读全文
posted @ 2019-06-12 18:12 zzfx 阅读(395) 评论(0) 推荐(0) 编辑
摘要:一、综述 Flux 被用来描述“单向”的数据流,且包含某些特殊的事件和监听器。 响应式编程是一种面向数据流和变化传播的编程范式 flux是响应式编程的一种? Flux 在本质上采用了模型-视图-控制器 (MVC) 的结构,但引入了很高的复杂性。 https://www.ibm.com/develop 阅读全文
posted @ 2019-06-11 18:37 zzfx 阅读(306) 评论(0) 推荐(0) 编辑
摘要:要素:store、reducer、dispatch/subscribe connect:将业务逻辑剥离到容器类,数据的双向绑定; 数据、操作、UI分离、命令封装 核心思想:对共享状态的维护; 核心代码: store={createStore(reducer) const reducer = (sta 阅读全文
posted @ 2019-05-17 10:56 zzfx 阅读(132) 评论(0) 推荐(0) 编辑