美文网首页
Angular也玩Redux--ngrx

Angular也玩Redux--ngrx

作者: salmon_163 | 来源:发表于2017-10-31 21:47 被阅读0次

Ngrx简介

将 component 与service 的状态统一放到 store,当 store 的状态有更新,將会自动更新到有 subscribe 的 component 和 service

View : 展示使用者的界面,例如: component

Action: 当 component 有任何 event 时,会对Ngrx发出 action

Dispatcher:负责接收component 传来的 action,并将 action 传给 reducer。

Store: Ngrx在浏览器端的状态存储库,存放所有的Action状态。

Reducer:根据 dispatcher 传来的 action,决定如何返回那种状态,即 state。

State: reducer 后返回的新状态

简要流程 Component -> Action -> Reducer -> Store -> Component。

相关文章

网友评论

      本文标题:Angular也玩Redux--ngrx

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