Solve the problem -Redux: Register a Store Listener

Tell us what’s happening:

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);

let carIsBroken = true;
const callCarOwner = () => console.log("Hello your car is done!");
const fixCar = (carIsBroken, callCarOwner) => {
if (carIsBroken === true) {
  carIsBroken = false;
// After the car is fixed, the last thing we do is call the car owner - that's our 'callback function'.
fixCar(carIsBroken, callCarOwner);
let count = 1;
const addOne = () => (count += 1);
function sayHi(addOne) {
return count;
// 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/84.0.4147.89 Safari/537.36.

Challenge: Register a Store Listener

Link to the challenge:

Welcome, divyathalishajahan.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

1 Like