Tell us what’s happening:
Hello friends, please help me! Im not understand how i must assign auth and count keys to Redux.combineReducers
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 = (state, action) =>
{
Redux.combineReducers({
count: counterReducer,
auth: authReducer
});
};
const store = Redux.createStore(rootReducer);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/combine-multiple-reducers/