redux: set initial state along with compose middleware -
the normal way set initial state (that overrides reducer's own default initial state) while creating store provide second argument createstore (how set initial state in redux). i've unfortunately cobbled tangle of stuff (pardon mixed metaphor) don't understand , don't know put desired initial state:
const composeenhancers = window.__redux_devtools_extension_compose__ || compose; const store = createstore( rootreducer, composeenhancers( applymiddleware(...middleware) ) ); i hope no 1 asks see combinereducers , middleware construction code 'cause that's more embarrassing.
still use second argument:
const store = createstore( rootreducer, { your: { initial: { state: {} } } }, composeenhancers( applymiddleware(...middleware) ) );
Comments
Post a Comment