React native redux map state to props not working

后端 未结 2 524
轮回少年
轮回少年 2020-12-18 05:45

I am new to react-native and I am trying to implement a simple sign up functionality using react-redux. For some reasons , mapping the state to props in connect is not work

2条回答
  •  时光说笑
    2020-12-18 06:38

    From your store defination,

    return combineReducers({
            nav: navReducer,
            signUpReducer : signUpReducer,
        });
    

    You defined the key signUpReducer for your SignUp component state. In order to access the state of this component,you should use this key followed by the state name.

    The correct way to access user is :

     export default connect(
          state => ({
              user : state.signUpReducer.user 
          })
    

    //use signUpReducer key

提交回复
热议问题