我写了这段代码来构建一个简单的 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/