问题分析
用React的Hooks渲染数据,得到数据想传值给子组件以Descriptions的样式渲染出来,但是报错如下
[]Uncaught Error: Objects are not valid as a React child (found:
object with keys {data}). If you meant to render a collection of
children, use an array instead.
问题解决
经过检查发现将子组件接收到的参数改为以下内容即可
function AptInfo(props){
const {detailData} = props;
return()
}
因为数据是以props传进来的,所以这里的参数必须写成props才行。
————————手动分隔—————————
以上仅为我个人遇到的错误,如有补充,欢迎评论区交流分享。