今天突然在联系React中遇到一开始就报 Super expression must either be null or a function, not undefined 百度,各种方法,...原来是这样(折腾半小时后一度怀疑人生). 先看看下面三种定义类组件有什么区别 1,第一种 (React.Component 后面是没有的 括号 切记,切记) 2,第二种 (React.Component C 没有大写) 3,第三种 (正确) 是不是懵的一看都差不多,但是只有最后一种是正…
今天在学习React中的类组件时,突然给我报错VM47:9 Uncaught TypeError: Super expression must either be null or a function, not undefined 我对照着语法看了我的代码半天,没啥问题,于是乎我百思不得其解(不知道你们是否看出毛病),于是我看起了度娘,希望从度娘中给我一个解答 但是看了老半天别人的东西 https://www.cnblogs.com/yezi1116/p/12724434.html 看他的…
if (isset($array[2])){ 抛出错误 Cannot use isset() on the result of an expression (you can use "null !== expression" instead) if (null !== $array[2]){ 抛出提示 Notice: Undefined offset: 2 in /var/www/alt.php on line 144 对了,这家伙是数组,目的是检测该数组中某个 key 值是否存…
最近在看es2015的一些语法,最实用的应该就是继承这个新特性了.比如下面的代码: $(function(){ class Father{ constructor(name, age){ this.name = name; this.age = age; } show(){ console.log(`我叫:${this.name}, 今年${this.age}岁`); } }; class Son extends Father{}; let son = new Son('金角大王', 200);…
1.React-router error: super expression must either be null or a function 原因:引入babel后写ES6风格的代码: class ComponentXX extends React.component{} 这里的C小写了,导致产生这个bug 改为大写就可以 ,不引入router不会产生这个bug 2.React-router 引入Link的时候,在ES6风格的代码下应该这样写: import {Link} from "rea…