Redux React tutorial

Tell us what’s happening:
Describe your issue in detail here.
it might sound a little ridicously for something who know a to build at a perfection code in react but, Im trying to bread in the ocean hahaha this is what I got to complete the task, how can I do the call function I just need to complete this step and if I need to modify what I wrote into this code please share any knowledge I will be very greatful to you thanks

The callback to store.subscribe should also increment the global count variable as the store is updated.

  **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 = 1;
const addOne = () => (count += 1);

// Change code below this line
const callAddUser = () => console.log("Hello you're been added!");
function AddUser() {
console.log("Hi you're been added!");

// 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/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53

Challenge: Register a Store Listener

Link to the challenge:

It would seem you’ve already written the code to pass this test, but then you also wrote some more code to print some stuff to screen which wasn’t requested in the challenge.

Right now you’ve subscribed your AddUser function to print some stuff… You have written an addOne function, but currently you haven’t subscribed that function to your store.

hey bro thanks for the advice and response, but seems like Im getting lost on my journey trying to understand the concepts and rules over the course Im just copy pasting all the answer trying to understand what am I doing, do you know any place where can I see more clearly how to use bot react and redux Im confuse,

Well, as you get further in the course and your understanding increases, you might want to go back to the beginning and see if you understand it more now, and if you can pass the challenges without peaking.

For this question, if you just add your addOne function to the store.subscribe declaration that should allow you to pass.

It is kind of confusing until the pieces start to snap into place… I also found the concepts a little tough to grasp in the course because I feel that Redux is some serious overkill for these smaller types of projects, and that it really shines in more complex multi-faceted projects. It felt silly writing a bunch of Action Creator functions and a reducer for a simple calculator, but I did notice once all that Redux framework was in place, making changes to the functionality was a lot simpler.

Keep at it :slight_smile: … REACTs own website also has a lot of additional reading on how some of this stuff works.

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