React Native Redux - 对象不是构造函数(评估'new ctor(props context)') [英] React native Redux - object is not a constructor (evaluating 'new ctor(props context)')
本文介绍了React Native Redux - 对象不是构造函数(评估'new ctor(props context)')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个尝试使用 Redux 的非常简单的页面....见下面的代码.
This is a very simple page that is trying to use Redux....see code below.
但是我收到错误 object is not a constructor (evaluating 'new ctor(props context)')
import React, {Component} from 'react';
import {Text, View} from 'react-native';
import {connect} from 'react-redux';
const mapStateToProps = state => ({
userId: state.auth.userId,
});
class Message extends Component {
render() {
return (
<View>
<Text>Text here</Text>
</View>
);
}
}
export default connect(
mapStateToProps,
null,
)(Message);
推荐答案
Reset cache work for me:
Reset cache work for me:
react-native start --reset-cache
其他解决方案是在导航器容器中使用 createSwitchNavigator
代替 createStackNavigator
.
Other solution is use createSwitchNavigator
instead createStackNavigator
, in your navigator container.
这篇关于React Native Redux - 对象不是构造函数(评估'new ctor(props context)')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文