Confused about store Listerner

Tell us what’s happening:
Describe your issue in detail here.
Can someone please explain to me, what the task is about. It is so confusing. What is store.subscribe()?

  **Your code so far**

const ADD = 'ADD';

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

const store = Redux.createStore(reducer);

// Global count variable:
let count = 0;

// Change code below this line

// Change code above this line

store.dispatch({type: ADD});
store.dispatch({type: ADD});
store.dispatch({type: ADD});
  **Your browser information:**

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

Challenge: Register a Store Listener

Link to the challenge:

store.subscribe is simply a method that gets called every time you call store.dispatch. Passing a function to it means that function gets run whenever store.dispatch is called. The challenge wants you to write a function that increments the count variable on each store.dispatch call, through the .subscribe method.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.