Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 642
N Sharma Avatar asked Dec 05 '25 20:12

N Sharma


1 Answers

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.

like image 176
Jeff P Chacko Avatar answered Dec 08 '25 09:12

Jeff P Chacko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!