Tell us what’s happening:
Describe your issue in detail here.
This is the simple and understandable way to combine multiple reducers to me
**Your code so far**
const INCREMENT = 'INCREMENT';
const DECREMENT = 'DECREMENT';
const increaseCount=()=>{return {type:INCREMENT}};
store.dispatch(increaseCount);
const decreaseCount=()=>{return{type:DECREMENT}};
store.dispatch(decreaseCount);
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 logingIn=()=>{return{type:LOGIN}};
store.dispatch(logingIn);
const logingOut=()=>{return{type:LOGOUT}};
store.dispatch(logingOut);
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/90.0.4430.212 Safari/537.36
Challenge: Combine Multiple Reducers
Link to the challenge: