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

Function wrapReducer

test/typescript/enhancers.ts:60–70  ·  view source on GitHub ↗
(
        reducer: Reducer<S, A, PreloadedStateToWrap>
      )

Source from the content-addressed store, hash-verified

58 preloadedState?: PreloadedState | undefined
59 ) => {
60 function wrapReducer<PreloadedStateToWrap>(
61 reducer: Reducer<S, A, PreloadedStateToWrap>
62 ): Reducer<S & ExtraState, A, PreloadedStateToWrap & ExtraState> {
63 return (state, action) => {
64 const newState = reducer(state, action)
65 return {
66 ...newState,
67 extraField: 'extra'
68 }
69 }
70 }
71 const wrappedPreloadedState = preloadedState
72 ? {
73 ...preloadedState,

Callers 2

enhancerFunction · 0.85
replaceReducerFunction · 0.85

Calls 1

reducerFunction · 0.70

Tested by

no test coverage detected