Tell us what’s happening:
Describe your issue in detail here.
Hi everybody, I’m stuck on this challange, anyone available to explain me this topic a little better? Thank you
**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 = 1;
const addOne = () => (count += 1);
// Change code below this line
function addCount() {
console.log(count);
}
store.subscribe(addCount);
// 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Challenge: Redux - Register a Store Listener
Link to the challenge: