B
B
Breezy
Search…
Custom reducers
Superglue generators will yarn add reduce-reducers and set up a reducers.js. If you find yourself needing additional functionality beyond what the generated reducers provide, just add your own reducers:
1
....
2
import reduceReducers from 'reduce-reducers'
3
import {getIn} from '@thoughtbot/superglue'
4
import produce from "immer"
5
6
function myCustomReducer(state = {}, action) {
7
....
8
}
9
10
...
11
12
const store = createStore(
13
combineReducers({
14
superglue: superglueReducer,
15
pages: reduceReducers(pagesReducer, applicationReducer),
16
additionalFoobar: myCustomReducer
17
}),
18
initialState,
19
applyMiddleware(thunk)
20
)
Copied!
Last modified 16d ago
Copy link