NgRx - How are states combined and initialized

ساخت وبلاگ

Vote count: 0

When we initialize our Store:

StoreModule.provideStore({r1: Reducer1, r2: Reducer2, ...})

we do pass the reducers to the Store to be stored. But we never actually pass the initial states to the store, except defining it in the reducers functions:

const someReducer = (state = initialState, act: Action) => { ... }

SO, is it that when application bootstraps, all the reducers are called once to acquire the initial state from reducer definition, and then store the state in the NgRx Store? If so, is it that every reducer must have an initial state value? otherwise the states will always be undefined?

And, if all reducers are called at bootstrap, how does NgRx make sure that the reduce must get to the default case?:

case ...: ...
default: return initialState

Thanks a lot! Any help appreciated!!

asked 6 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 262 تاريخ : شنبه 16 ارديبهشت 1396 ساعت: 23:51