Tell us what’s happening:
Why isn’t this code passing the tests? I can’t see the error.
Thanks in advance
Your code so far
const INCREMENT = 'INCREMENT'; // define a constant for increment action types
const DECREMENT = 'DECREMENT'; // define a constant for decrement action types
const defaultState= {
counter: 0
}
const counterReducer = (state=defaultState,action) => {
switch (action.type) {
case INCREMENT:
return {counter:state.counter+1};
case DECREMENT:
return {counter:state.counter-1};
default:
return defaultState;
}
};
const incAction = () => {
return {
type: INCREMENT
}
};
const decAction = () => {
return {
type: DECREMENT
}
};
const store = Redux.createStore(counterReducer);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/write-a-counter-with-redux