inulax createStore,dispatch API兼容redux
This commit is contained in:
parent
22036bc75d
commit
e31cf7295d
|
@ -91,6 +91,10 @@ function mergeData(state, data) {
|
|||
}
|
||||
|
||||
export function createStore(reducer: Reducer, preloadedState?: any, enhancers?: StoreEnhancer): ReduxStoreHandler {
|
||||
if (typeof preloadedState === 'function' && typeof enhancers === 'undefined') {
|
||||
enhancers = preloadedState;
|
||||
preloadedState = undefined;
|
||||
}
|
||||
const store = createStoreX({
|
||||
id: 'defaultStore',
|
||||
state: { stateWrapper: preloadedState },
|
||||
|
@ -107,6 +111,7 @@ export function createStore(reducer: Reducer, preloadedState?: any, enhancers?:
|
|||
return;
|
||||
} // NOTE: reducer should never return undefined, in this case, do not change state
|
||||
state.stateWrapper = result;
|
||||
return action;
|
||||
},
|
||||
},
|
||||
options: {
|
||||
|
|
Loading…
Reference in New Issue