Redux problem store.subscribe()

I need to use store.subscribe() but Idk where to go with it.
I’m trying to review redux to use with react for my calculator project. Now I’m stuck. Can anyone help? My brain is fried.

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)

// 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/81.0.4044.122 Safari/537.36 Edg/81.0.416.64.

Challenge: Register a Store Listener

Link to the challenge:

Between the

// change code below this line

// change code above this line

lines is where the code must go

Yes , you are halfway there. You made the callback function.
Now you need to add a listener that calls that function.

For that you use the subscribe method and pass in the function as an argument.