Super expression must either be null or a function, not undefined

Posted KEEP

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Super expression must either be null or a function, not undefined相关的知识,希望对你有一定的参考价值。

按照之前买的用javascript开发移动应用的例子来编写的,然后报了这个错。我的头部声明是这样的

var React = require(‘react-native‘);
var {
Text,
View
} = React;

经过查询后是由于‘React‘和‘Component‘从‘react native‘分离到了‘react‘模块。
所以这里我们只引入‘react native‘的模块是不够的,改成这样:

import React, { Component } from ‘react‘;
import {
AppRegistry,
StyleSheet,
Text,
View
} from ‘react-native‘;

 

以上是关于Super expression must either be null or a function, not undefined的主要内容,如果未能解决你的问题,请参考以下文章

reactjs - 在 npm run build 得到 Uncaught TypeError: Super expression must be null or a function [重复]

React-native 从 0.61.5 升级到 0.63.2:TypeError: Super expression must be null or a function

Uncaught TypeError: Super expression must be null or a function, not undefined (React.js, Flux, ES6)

TypeError: super(type, obj): obj must be an instance or subtype of type

Media query expression must begin with '(' 错误

python中super出现的TypeError: must be type, not classobj 原因及解决