代码传到github了点这里
代码传到github了点这里
代码传到github了点这里
npm i
npm start
浏览器输入地址 http://localhost:3011/
下面大致描述一下问题:
代码结构是这样的
App组件 (使用{ React.cloneElement(this.props.children, this.props) } )
itemList组件 (使用this.props.children)
oneItem组件 (一些内容)
//App.js
//使用React.cloneElement是为了把一些redux得到的porps传过去问题本身和redux本身无关
{ React.cloneElement(this.props.children, this.props) }
//itemList.js
- 1
- 2
- 3
- 4
{this.props.children}
//oneItme.js
这是{this.props.parmas.id}的详情
App.js使用{ React.cloneElement(this.props.children, this.props) }
App.js使用{this.props.children} 
怎么解决这种显示两次的问题?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
{ React.cloneElement(this.props.children, this.props) }你把 this.props 里的 children 传给 this.props.children 啦!
不懂你为什么要 clone 一下。