[SOLVED] Get State from the Redux Store

Tell us what’s happening:

Can someone help me please?

Your code so far


const store = Redux.createStore(
  (state = 5) => state
);

// change code below this line
let currentState = store.getState(store)

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/get-state-from-the-redux-store

let currentState = store.getState(store)

You are passing the variable store to getState - you do not need to do that - this is already a method of store - you don’t need to send it anything and this is just confusing the method.

2 Likes

The below code snippet works

let currentState = store.getState();