【问题标题】:Expo.io using React Native - "Super expression must be either null or a function"Expo.io 使用 React Native - “超级表达式必须为空或函数”
【发布时间】:2021-09-19 21:56:55
【问题描述】:

代码:

    import React from 'react'
import { Text, View, StyleSheet } from 'react-native';

export default class App extends React.Component(){
  render(){
    return(
     <View> </View>
    )
  }
}

为什么会返回错误?我在 Expo.io 上使用的是 42.00 版本,并且我的浏览器已完全更新。

【问题讨论】:

    标签: reactjs react-native expo


    【解决方案1】:

    您不小心在React.Component 之后添加了()。应该是这样的:

    import React from 'react'
    import { Text, View, StyleSheet } from 'react-native';
    
    export default class App extends React.Component {
      render(){
        return(
         <View> </View>
        )
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-20
      • 1970-01-01
      相关资源
      最近更新 更多