我是靠谱客的博主 酷炫蜻蜓,这篇文章主要介绍Super expression must either be null or a function, not undefined 报错及解决,现在分享给大家,希望可以做个参考。
在 React 项目中,遇到了上面的报错信息。
Super expression must either be null or a function, not undefined
查阅资料,进行这样的分析:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20// 原始代码 'use strict'; import Realm from 'realm'; class Todo extends Realm.Object {} Todo.schema = { name: 'Todo', properties: { done: {type: 'bool', default: false}, text: 'string', }, }; class TodoList extends Realm.Object {} TodoList.schema = { name: 'TodoList', properties: { name: 'string', items: {type: 'list', objectType: 'Todo'}, }, }; export default new Realm({schema: [Todo, TodoList]});
这是原始的JS代码(使用React框架)
可能的原因有以下几个:
1、确认一下React.Component是否书写正确,不是React.component或者React.Comonent…(这是我个人的问题,component 拼写错误)
2、检查下React版本,确保更新到0.13.x及更高版本 :This is fixed in the newest version 0.13.0 which is coming out shortly. You can try the release candidate now by setting the version to 0.13.0-rc in your package.json
3、检查模块间是否存在循环依赖
4、确认导入的库是否正确
import React,{Component} from 'react';
Component 需要从原生的React 中引入,不是从 react-router中引入。
最后
以上就是酷炫蜻蜓最近收集整理的关于Super expression must either be null or a function, not undefined 报错及解决的全部内容,更多相关Super内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复