I didn't get why it's not updating count in redux

Tell us what’s happening:
i proceed as documentation says >> first create a cb method and pass it to store.subscribr() method. but it didn’t update count.

Your code so far


const ADD = 'ADD';

const reducer = (state = 0, action) => {
  switch(action.type) {
    case ADD:
      return state + 1;
    default:
      return state;
  }
};

const store = Redux.createStore(reducer);

// global count variable:
let count = 0;

// change code below this line
const incr = (count)=>{
  count++;
}
store.subscribe(incr);
// change code above this line

store.dispatch({type: ADD});
console.log(count);
store.dispatch({type: ADD});
console.log(count);
store.dispatch({type: ADD});
console.log(count);

Your browser information:

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

Link to the challenge:

In your function

const incr = (count)=>{
  count++;
}

you are incrementing the local count variable passed to it, not the global count variable defined beforehand (let count = 0;).

To increment the global count variable instead, simply remove the local count variable defined in the function.