gpt4 book ai didi

ios - super 表达式必须为 null 或函数

转载 作者:行者123 更新时间:2023-11-29 12:04:57 26 4
gpt4 key购买 nike

我写了这段代码来构建一个简单的 React Native UI

'use strict';
var React = require('react-native');
var styles = React.StyleSheet.create({
text : {
color : 'black',
backgroundColor : 'white',
fontSize : 30,
margin : 80
}
});
class PropertyFinderApp extends React.Component() {
render() {
return React.createElement(React.text,{style : styles.text},"Hello World");
}
}
React.AppRegistry.registerComponent('PropertyFinder',function(){ return PropertyFinderApp});

我收到错误“ super 表达式必须为空或函数”

我已经尝试安装最新版本的react,但还是无法解决!

最佳答案

导致错误的是 React.Component(),它应该没有括号 React.Component。当你解决这个问题时,你会因为使用小写的 React.text 而收到另一个错误,它应该是 React.Text

关于ios - super 表达式必须为 null 或函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35404384/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com