I am doing the right way but it didn't work it why?

Tell us what’s happening:

Your code so far


const INCREMENT = 'INCREMENT';
const DECREMENT = 'DECREMENT';

const counterReducer = (state = 0, action) => {
switch(action.type) {
  case INCREMENT:
    return state + 1;
  case DECREMENT:
    return state - 1;
  default:
    return state;
}
};

const LOGIN = 'LOGIN';
const LOGOUT = 'LOGOUT';

const authReducer = (state = {authenticated: false}, action) => {
switch(action.type) {
  case LOGIN:
    return {
      authenticated: true
    }
  case LOGOUT:
    return {
      authenticated: false
    }
  default:
    return state;
}
};

const rootReducer = Redux.combineReducers({
count: counterReducer(),
auth : authReducer()
});// define the root reducer here

const store = Redux.createStore(rootReducer);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36.

Challenge: Combine Multiple Reducers

Link to the challenge:

Take another look at the example. combineReducers accepts reducers, not the state returned by reducer.

1 Like

Yes, I am already found it thank you for your reply.