**Cuéntanos qué está pasando:
I can’t move forward in the lesson, I fulfill all the points except the last one “The callback function to store.subscribe must also increment the global variable count as the store is updated.” I can’t find the problem, here below is my code.
Describe tu problema en detalle aquí.
**Tu código hasta el momento**
const ADD = 'ADD';
const reducer = (state = 0, action) => {
switch(action.type) {
case ADD:
return state + 1;
default:
return state;
}
};
const store = Redux.createStore(reducer);
// Variable global count:
let count = 1;
const addOne = function() {
return count += 1;
}
// Cambia el código debajo de esta línea
store.subscribe(addOne);
// Cambia el código encima de esta línea
store.dispatch({type: ADD});
console.log(count);
store.dispatch({type: ADD});
console.log(count);
store.dispatch({type: ADD});
console.log(count);
**Información de tu navegador:**
El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Desafío: Redux - Registra un escucha al almacén
Enlaza al desafío: