a4-reducer
Install
npm install a4-reducer
How to setup actions
auth-action.ts
; ; ;
How to setup a store
auth-store.ts
;;;;
How to use the store in your app
;; private username$: Observable<string>; constructorprivate authStore: AuthStore handleSignInusername: string, password: string
To enable console log
; if !environment.production
Difference between .map and .select
Select will only fire the subscription when the current alue is different than the last while Map will fire the subscription when there is a new value set in the store.
How to add side effect without using decorator
; boundHandleThisAction = this.handleThisAction.bindthis; ngOnInit ngOnDestroy
Immutable Methods (protected)
These immutable methods can only be used within the store class.
immutableReplaceElement
Returning a new array with element at index being replaced by newElement.
immutableReplaceElementarray: T, newElement: T, index: number: T
immutableRemoveElement
Returning a new array with element at index being removed.
immutableRemoveElementarray: T, index: number: T
immutableInsertElement
Returning a new array with element being inserted at specified index.
immutableInsertElementarray: T, element: T, index: number: T
immutablePrependElement
Returning a new array with element inserted at the start (first element) of the given array.
immutablePrependElementarray: T, element: T: T
immutableAppendElement
Returning a new array with element inserted at the end (last element) of the given array.
immutableAppendElement<T>(array: T[], element: T): T[]