![Malayalam movie collector](https://loka.nahovitsyn.com/113.jpg)
Global single source of truth,不像 Flux same as multiple Store
#Redux observable update#
ElmAlthough a language,but actually mainly used for 网页开发,它设计了一种 Model、View、Message、Update update ideas. The leaders of this arms race are Redux 莫属.当提到 Redux,不得不提 Elm such a legendary language.
#Redux observable code#
从应用场景来看,Flux 除了在 Facebook Outside of internal large-scale applications,Rarely used in the industry.Because of its concepts and boilerplate code compared to rising stars,还是有点多.From today's point of view,Flux It can be called a model of throwing bricks and attracting jade,Started a state management arms race. 具体的流程是这样的,Store Stores all the data of the view layer,当 Store changes will cause View 层的更新.If triggered at the view layer Action,比如点击一个按钮,The current page data value will change.Action 会被 Dispatcher Perform unified sending and receiving processing,传递给 Store 层.由于 Store Layers are already registered Action 的处理逻辑,After processing the corresponding internal state change,会触发 View 层更新. Store是数据层,Maintained data and data processing logic.ĭispatcheris the central hub for managing the flow of data.每一个 Store 提供一个回调.当 Dispatcher 接收一个 Action 时,所有的 Store receive in the registry Action,Then generate data through callback.ĪctionCan be understood as an event notification,通常用 type 标记. Let me first explain the concepts involved in the above picture. This is a headache for people who take over old code,because they are afraid to take risks,So we can't easily modify the code.这也正是 MVC 模式被 Facebook reason for abandonment.
![redux observable redux observable](https://cdn-images-1.medium.com/max/1600/1*u6CcJ_owqR90tWLK7sN-NQ.jpeg)
whenever a new feature is added,The system complexity will grow wildly.如下图所示,Model 与 View The relationship is intricate,Difficult to understand and debug,尤其是 Model 与 View 之间还存在 双向数据流动.
![redux observable redux observable](https://files.gitter.im/redux-observable/redux-observable/67ul/2019-10-10.png)
What are the current state management frameworks popular in the community??莫过于 Flux、Redux、Mobx 了.In addition to answering the content of these frameworks themselves,You'd better combine personal thinking,补充一些 个人观点.įlux I got the impression that there was a thunderbolt on the ground.,有种“天不生 Flux,State management is like a long night”的感觉.回顾历史,你会发现 Flux 如同 React The same huge impact on the industry.如果你对 Flutter 与 SwiftUI 有了解的话,就能理解 React That profound impact on rising stars.Flux 同样如此,它提出了一种 MVC successful practice outside-单向数据流,This has also profoundly affected“后来人”.Ģ014 的 Facebook F8 A point of view was raised at the conference,MVC 更适用于 小型应用,But when targeting large front-end projects,MVC will make the project 足够复杂,i.e. 当然,Although the title requires a,But if you can name more state management frameworks,That's definitely a plus.This can prove that your development experience is rich enough,And have a good understanding of community popular.
![redux observable redux observable](http://yoyoyohamapi.me/2018/08/18/%E4%BD%BF%E7%94%A8_redux-observable_%E5%AE%9E%E7%8E%B0%E7%BB%84%E4%BB%B6%E8%87%AA%E6%B2%BB/rxjs_redux_saga.jpg)
The state management framework solves these problems very well,to be popular.所以在 React 的开发中,More or less will use the state management framework.The mastery of the state management framework also becomes the interview 必考点.
![redux observable redux observable](https://i.ytimg.com/vi/f9S5uYqVGaU/maxresdefault.jpg)
破题Īs mentioned in the previous lecture:Components that span multiple levels are still required 共享状态、 响应变化.Traditional state promotion schemes are difficult to solve this problem efficiently,比如 Context.Ĭontext Stored variables make it difficult to trace data sources and identify changes.When components depend on Context 时,Will improve component coupling,This is not conducive to the reuse and testing of components. 在面试中,If the interviewer asks you to list one React 状态管理框架,how should you answer?I'll take you to discuss this.
![Malayalam movie collector](https://loka.nahovitsyn.com/113.jpg)