TypeError: Cannot call a class as a function

#1

各位大神,帮帮我,搞不定,把这部分换成一个简单的函数组件就没问题,类组件就错误,小弟纯新手,多多指点

问题:

#2
constructor(props){
  super(props);
}

试试这样呢

#3

还是不行,感觉问题不在这儿

#4

多谢你的回复,问题查清了:

AddItem.prototype = {
    onAdd: PropTypes.func.isRequired
};

改成下面即可

AddItem.prototypes = {
    onAdd: PropTypes.func.isRequired
};
1 Like
#5

非常棒:+1:
我竟然遇到一模一样的问题
解决方案也是!