MCPcopy
hub / github.com/reduxjs/redux / enhancer

Function enhancer

test/typescript/enhancers.ts:17–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 dispatch: PromiseDispatch
16 }> =
17 createStore =>
18 <S, A extends Action, PreloadedState>(
19 reducer: Reducer<S, A, PreloadedState>,
20 preloadedState?: PreloadedState | undefined
21 ) => {
22 const store = createStore(reducer, preloadedState)
23 return {
24 ...store,
25 dispatch: (action: any) => {
26 if (action.type) {
27 store.dispatch(action)
28 } else if (action.then) {
29 action.then(store.dispatch)
30 }
31 return action
32 }
33 }
34 }
35
36 const store = createStore(reducer, enhancer)
37

Callers

nothing calls this directly

Calls 2

createStoreFunction · 0.85
wrapReducerFunction · 0.85

Tested by

no test coverage detected