Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe have some mistake on combineReducers? #52

Closed
incuisting opened this issue Jan 31, 2018 · 2 comments
Closed

Maybe have some mistake on combineReducers? #52

incuisting opened this issue Jan 31, 2018 · 2 comments

Comments

@incuisting
Copy link

incuisting commented Jan 31, 2018

Thank you very much for your guide, but there are some puzzles in my practice.
This guide:

import { combineReducers } from 'redux';
import { routerReducer, RouterState } from 'react-router-redux';

import { countersReducer, CountersState } from '@src/redux/counters';
import { todosReducer, TodosState } from '@src/redux/todos';

interface StoreEnhancerState { }

export interface RootState extends StoreEnhancerState {
  router: RouterState;
  counters: CountersState;
  todos: TodosState;
}

import { RootAction } from '@src/redux';
export const rootReducer = combineReducers<RootState, RootAction>({
  router: routerReducer,
  counters: countersReducer,
  todos: todosReducer,
});

combineReducers Generic with two arguments in the above example.
But in my practice ,i find combineReducers don't need two variables.
So i check the declaration file of redux.

export function combineReducers<S>(reducers: ReducersMapObject): Reducer<S>;

This means that only one parameter is required.
Please confirm this question。If it is wrong, please fix it。

My redux version:3.7.2

@piotrwitek
Copy link
Owner

Please check updated setup section.

@jstoeffler
Copy link

For those who run in the same issue: you need to upgrade to redux v4.x.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants