redux-utilities / reduce-reducers

Reduce multiple reducers into a single reducer from left to right

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using reducers from an external library

bravo-kernel opened this issue · comments

Hope I may ask for some assistance here. I'm using the redux-query library which comes with the following 2 reducers.

import { entitiesReducer, queriesReducer } from 'redux-query';

export const rootReducer = combineReducers({
  entities: entitiesReducer,
  queries: queriesReducer,
});

Works fine, entitiesReducer dynamically fills entities (with e.g. projects and users) after executing network requests.

I would however like to create the store with the following initial state so I can keep my selectors pure.

  entities: {
    projects: {
      allIds: [],
    }
  },

I have tried about every combination I could think of. Could this be possible using reduce-reducers?

I see createStore takes an optional (second) argument that can be used for this, apologies for the noise.