0
const mapStateToProps = state => {
  console.log(state);
  return {
    counter: state.counter,
    isLogged: state.isLogged
  }
}

This is how I passed the states. However, error comes saying counter and isLogged is undefined. Why ?

Dj Seymur
  • 1
  • 2
  • 1
    You need to share more code than this. No one can tell you anything just by looking at a function. Have you setup your reducer? Do they have a default state? Is your data flowing through your reducers? Do you get data in your hook? What happens when you console log state? – Roco CTZ Jul 23 '20 at 23:04

1 Answers1

0

The state will contain an object with all your reducers so check if counter and isLogged are the names of your reducers. I would suggest removing the state.counter and the state.isLogged on the return and checking what the console.log(state) prints