ngrx初识
ngrx初識
在使用之前需要安裝ngrx
npm install @ngrx/store --save 或者 yarn add @ngrx/storengrx/store:保存了ReduxAPI的核心概念,使用RxJS擴(kuò)展的Redux實(shí)現(xiàn)。使用可觀察對象來簡化了監(jiān)聽事件的訂閱等操作。
dispatch&reducer&state
dispatcher,reducer,state都是基于BehaviorSubject的,BehaviorSubject:儲存著要發(fā)射給消費(fèi)者的最新的值。無論何時一個新的觀察者訂閱它,都會立即接受到這個來自BehaviorSubject的”當(dāng)前值”。
Store
官方英文解釋:
Like a traditional database represents the point of record for an application, your store can be thought of as a client side ‘single source of truth’, or database. By adhering to the 1 store contract when designing your application, a snapshot of store at any point will supply a complete representation of relevant application state. This becomes ex
總結(jié)
- 上一篇: 移动站应该尝试百度MIP的五个原因
- 下一篇: 歌手的分数【C#】