控制台报错
invariant.js?4599:39 Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `Department`
Department中的render
render(){
// const style={
// display:none
// }
const currentDepartment = this.props.currentDepartment;
// debugger;
const departList = this.props.departList;
const userList = this.props.userList;
let getDepartData = this.props.getDepartData;
const _this = this;
debugger;
const list = getDepartData.call(_this, currentDepartment, departList, userList);
return (
{this.props.currentDepartment.D_NAME}
{list}
)
}
调用render的递归
departList = departments.map(function(item){
if(department.SHOW_ID == item.D_PARENTID_SHOW_ID){
return
( )
}
})
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
“Department中的render”里面的{list}不能直接这么用。list是一个object的数组,react不知道怎么把object转成响应的HTML,你得告诉它,应该