简体   繁体   中英

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

在此输入图像描述

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

看一下使用reducer创建商店的第10行。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM