Write a Counter with Redux Help

Tell us what’s happening:

I am not sure what I am missing. Maybe I am miss interpreting the directions? Any help would be appreciated.

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 initialState = {
  count: 0
};

const counterReducer = (state = initialState, action) => {
  switch(action.type){
    case INCREMENT:
    return {
      count: state.count + 1
    };
    
    case DECREMENT:
    return {
      count: state.count - 1
    };
    default:
      return state;
  }
 
}; // define the counter reducer which will increment or decrement the state based on the action it receives
*/
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 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); // define the Redux store here, passing in your reducers

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/write-a-counter-with-redux/

1 Like

Hello, can you tell me what challenges are failing?

It appears you have forgotten a closing bracket, Don’t worry, it happens to the best of us :grinning:
See if you can find this closing bracket and correct the code.

After that you need one more curly bracket

thank you. I can believe I missed it.