Write a Counter with Redux(small question )

Tell us what’s happening:
I just have a small question about the difference between these two lines of code below:


const incAction = ()=>{return {type:INCREMENT}};

const incAction = ()=> {type:INCREMENT};

I don’t know why the first one could pass this challenge and the second could not do.

Thank you for all your answer !!!

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 ;

      case DECREMENT:
        return state - 1 ;

      default :
        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); // define the Redux store here, passing in your reducers

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15.

Link to the challenge:

I have already solved this question. Because of the ambiguous braces, the function incAction() couldn’t return an object of action. :grinning: