/*
expected state:
{
accounts: {
items: []
isFetching: boolean
fetchingErrorMessage: string
}
}
*/
// accountReducers.js
function accounts() {}
function isFetching() {}
function fetchingErrorMessage() {}
export default combineReducers({
items: accounts,
isFetching,
fetchingErrorMessage
});
//combineReducers is from react-redux library, result is the same as here:
export default function (state = {}, action) {
return {
items: accounts(state.accounts.items, action),
isFetching: isFetching(state.accounts.isFetching, action),
fetchingErrorMessage: fetchingErroMessage(state.accounts.fetchingErrorMessage, action)
};
}
// rootReducer.js
// import accountReducers from "accountReducers.js"
export default combineReducers({
accounts: accountReducers
});