-
uncaught at check call: argument fn is undefined
和后台交互的数据流出现问题,检查dispatch、models、api.js。 -
Cannot read property 'map' of undefined
从后台来的数据,用.map()遍历,分配给<Select>的子组件<Option>。但在还未取到后台数据前,array的初始值为undefined,所以代码运行到.map()就会报错。用三元运算符分流。
更改前:
{node.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
更改后:
{!node ? '' : node.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
- Expected an assignment or function call and instead saw an expression.
-
the children of
Select
should beSelect.Option
orSelect.OptGroup
, instead ofTreeSelect
.+React does not recognize the computedMatch prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase computedmatch instead. If you accidentally passed it from a parent component, remove it from the DOM element.
错误:错误的嵌套或使用了antd组件<>会报这个错。无意中在<TreeSelect>外又包了一层<Select>
{/* {!node ? '' : node.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})} */} - [Invalid attempt to spread non-iterable instance]
情况1:请求后端的参数有错误。错误:console.log(...fieldsValue); 错误的使用了...
情况2:使用了错误的数据类型,在该使用数组的情况下使用了对象。用typeof对数据类型进行检查 - Cannot read property 'props' of undefined
在constructor()里 bind