N Sharma
N Sharma

Reputation: 34507

How to map state to props in redux in react native

Hi I am reading this tutorial https://www.packtpub.com/books/content/how-get-started-redux-react-native where guy explained about use case of redux in react native application. Well, I gotcha things there, but I see that

userReducers is not defined there in class Login.js I am not sure where it is being referenced.

Can anyone help me what is that ? Shouldn't it state.user instead user.userReducers.user

enter image description here

Upvotes: 3

Views: 1427

Answers (1)

Jeff P Chacko
Jeff P Chacko

Reputation: 5018

This is because in your index.ios.js file while creating the redux store, you are name-spacing this data under userReducers.

take a look at line 10 where you are creating the store with the reducers.

According to line 10 where you are creating the store, all state variables added by userReducers will be available under state.userReducers.

Upvotes: 2

Related Questions