[英]React + Redux, nothing returned from render()
Nothing returned from render()
, data
is an array
and it's not undefined
or null
(checked with debugger
). 从
render()
返回的所有data
都不是array
并且它不是undefined
或为null
(已通过debugger
检查)。 It iterate all needed data but then nothing returned. 迭代所有需要的数据,但是什么也没有返回。
Here you can find full code if it needed: https://github.com/BakuganXD/taskManager/tree/boardUpdate 如果需要,您可以在这里找到完整的代码: https : //github.com/BakuganXD/taskManager/tree/boardUpdate
Component.js: Component.js:
class ProfilePage extends React.Component {
//several functions
render() {
const { loading, error, data, isEditing, editToogle } = this.props;
if (!loading && !error) {
{data.map( (value, index) => {
if (!isEditing[value.id]) {
return (
//a lot of JSX code, value is not undefined
} else {
return (
//another big JSX part
);
}
}
) }
} else return <p>Loading</p>;
}
}
You need to return data.map
results. 您需要返回
data.map
结果。 Also, remove {}
around data.map
另外,删除
data.map
周围的{}
class ProfilePage extends React.Component {
//several functions
render() {
const { loading, error, data, isEditing, editToogle } = this.props;
if (!loading && !error) {
return data.map( (value, index) => {
if (!isEditing[value.id]) {
return (
//a lot of JSX code, value is not undefined
)
} else {
return (
//another big JSX part
);
}
})
} else return <p>Loading</p>;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.