简体   繁体   English

如何将状态映射到redux中的props以反应原生

[英]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. 嗨,我正在阅读本教程https://www.packtpub.com/books/content/how-get-started-redux-react-native ,其中man解释了redux在本机应用程序中的用例。 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. userReducers中没有定义userReducers我不确定它被引用的位置。

Can anyone help me what is that ? 任何人都可以帮助我这是什么? Shouldn't it state.user instead user.userReducers.user 不应该是state.user而不是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 . 这是因为在创建redux存储时,在index.ios.js文件中,您将在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 . 根据您创建商店的第10行, userReducers添加的所有状态变量都将在state.userReducersstate.userReducers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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