【问题标题】:Super expression must either be null or a function超级表达式必须为 null 或函数
【发布时间】:2016-02-15 08:15:59
【问题描述】:

我已经编写了这段代码来构建一个简单的 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});

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

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

【问题讨论】:

  • React.text 应该是 React.Text

标签: ios react-native


【解决方案1】:

导致您的错误的是React.Component(),它应该没有括号React.Component。当你修复它时,你会因为使用小写React.text 而得到另一个错误,它应该是React.Text

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-23
    • 2023-01-29
    • 1970-01-01
    • 2021-10-20
    • 2018-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多