Redux - Register a Store Listener

Tell us what’s happening:
Describe your issue in detail here.
It’s saying the callback to store.subscribe should also increment the global count variable as the store is updated. What does that mean???

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 addOne = () => (count += 1);
function sayHi() {
  console.log("Hi!");
}
store.subscribe(sayHi)
// 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Redux - Register a Store Listener

Link to the challenge:

I see this function that increments the global variable count, but I do not see where you passed this function to the subscribe method. I do see where you passed a function named sayHito thesubscribemethod, but this function does nothing to thecount` variable.

Thanks a lot. I’ve gotten it