简体   繁体   English

类型错误:超级表达式必须为空或反应本机中的函数_inherits

[英]TypeError: Super expression must either be null or a function _inherits in react native

In react-native.I will create a simple app and also a web app.在 react-native.I 中,我将创建一个简单的应用程序和一个 Web 应用程序。 React-native application output the error show in image. React-native 应用程序输出错误显示在图像中。

Super expression must either be null or a function, not undefined超级表达式必须为 null 或函数,不能为 undefined

Error image错误图片

My code is:我的代码是:

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

class App extends React.Component() {
 render(){
   return (
     <View style={styles.container}>
       <Text>Hello World</Text>

     </View>
   );
 }
}
export default App;

const styles = StyleSheet.create({
 container: {
   flex: 1,
   backgroundColor: '#fff',
   alignItems: 'center',
   justifyContent: 'center',
 },
});

Try removing the parenthesis on the class definition.尝试删除类定义上的括号。

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

class App extends React.Component {
 render(){
   return (
     <View style={styles.container}>
       <Text>Hello World</Text>

     </View>
   );
 }
}
export default App;

const styles = StyleSheet.create({
 container: {
   flex: 1,
   backgroundColor: '#fff',
   alignItems: 'center',
   justifyContent: 'center',
 },
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React Native,TypeError:超级表达式必须为空或函数 - React Native, TypeError: Super expression must either be null or a function 类型错误:超级表达式必须为空或函数 _inherits - TypeError: Super expression must either be null or a function _inherits 反应本机错误-超级表达式必须为null或函数,且未定义 - React Native error - Super expression must either be null or a function, not undefined React Native-Super表达式必须为null或函数 - React Native - Super expression must either be null or a function TypeError:超级表达式必须为null或函数 - TypeError: Super expression must either be null or a function React-Native升级0.26“超级表达式必须为null或函数,不能为null” - React-Native Upgrade 0.26 “Super expression must either be null or a function, not null” TypeError:超级表达式必须为null或函数,且未定义 - TypeError: Super expression must either be null or a function, not undefined 使用webpack的react-redux给出错误Uncaught TypeError:超级表达式必须为null或函数,且未定义 - react-redux with webpack giving error Uncaught TypeError: Super expression must either be null or a function, not undefined webpack、react 和 babel:未捕获的类型错误:超级表达式必须为 null 或函数,而不是未定义 - webpack, react and babel: Uncaught TypeError: Super expression must either be null or a function, not undefined React JS路由不起作用(未捕获的TypeError:超级表达式必须为null或函数,而不是对象) - React JS routing not working (Uncaught TypeError: Super expression must either be null or a function, not object)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM