这是一个非常简单的页面,正在尝试使用 Redux....请参阅下面的代码。
但是我收到错误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);
重置缓存对我有用:
react-native start --reset-cache
其他解决方案是使用createSwitchNavigator
反而createStackNavigator
,在您的导航器容器中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)