This section is likely not helpful for you unless you are building your own plugin or adding middleware. For a list of common init options, see the @rematch/core API
If you just need to include a redux library in your store, see the recipe for redux plugins
- init
This section provides access to your Redux setup, along with options to overwrite Redux methods.
init({
redux: {
initialState: any,
},
})
The initialState of your app. This is likely not necessary, as the state of your models will overwrite the initial state.
const someReducer = (state, action) => {
switch (action.type) {
default:
return state
}
}
init({
redux: {
reducers: {
someReducer,
},
},
})
Allows passing in of reducer functions, rather than models. While not recommended, this can be used for migrating a Redux codebase or configuring different Redux extensions.
init({
redux: {
middlewares: [customMiddleware()],
},
})
Add middleware to your store.
init({
redux: {
enhancers: [customEnhancer()],
},
})
Add enhancers to your store.
init({
redux: {
rootReducers: {
RESET: (state, action) => undefined,
},
},
})
A way to setup middleware hooks at the base of your root reducer. Unlike middleware, the return value is the next state. If undefined
, the state will fallback to the initial state of reducers.
init({
redux: {
combineReducers: customCombineReducers,
},
})
Allows access to overwrite Redux's combineReducers
method. Currently necessary for setting up Redux persist v5.
init({
redux: {
createStore: customCreateStore,
},
})
Allows access to overwrite Redux's createStore
method. Currently necessary for setting up Reactotron with Redux.
init({
redux: {
devtoolOptions: customDevtoolOptions,
},
})
Provides access to redux devtool options. Read more about configuring devtools under devtool recipes.