Write a Counter with Redux middle two tests

Tell us what’s happening:
Im faling the middle two tests:
The Redux store should initialize with a state of 0.

Dispatching incAction on the Redux store should increment the state by 1.

its driving me nuts. please help

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 counterReducer = (state = 0,action) => {
    switch (action.type){
        case INCREMENT: return state + 1; break;
        case DECREMENT: return state - 1; break;
        defualt: return state
    }
}; // define the counter reducer which will increment or decrement the state based on the action it receives

const incAction = () => {return {type: INCREMENT}}; // define an action creator for incrementing

const decAction = () => {return {type: DECREMENT}}; // define an action creator for decrementing

const store = Redux.createStore(counterReducer);

Your browser information:

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

Link to the challenge:

1 Like

you misspelled default

if you ommit return here you will face the same problem.