使用redux存储访问来响应createBottomTabNavigator

时间:2019-06-03 17:58:24

标签: javascript reactjs redux

我正在尝试基于jwt上的数据的动态标签导航器,但是我不知道如何从中访问redux数据

这就是我所拥有的:

const Navigation = ({ jwt }) => {
  console.log('jwt:', jwt);
  return createBottomTabNavigator({
    FeedStack,
    WorkStack,
    ProfileStack,
    RequestStack,
  });
}
const mapStateToProps = ({
  common: { jwt },
}) => ({
  jwt,
});
export default connect(mapStateToProps)(Navigation);

jwt可用,但对于导航不是有效的组件,所以出现此错误:

Warning: Functions are not valid as a React child. This may happen if you return a Co
mponent instead of <Component /> from render. Or maybe you meant to call this functio

在具有有效组件传递给redux的同时如何访问道具?

1 个答案:

答案 0 :(得分:0)

我认为您应该将createBottomTabNavigation放在div标记中。