React-renderProps(类似于vue的插槽技术,以下为函数式组件示例)

第一种render props

类似于vue中的插槽slot技术,主要用于组件复用

父组件Child2;子组件Grandson;

通过父组件标签render申明传递的参数content

 父组件Child2中render传递参数

 在Grandson中接收展示父组件传递的参数

第二种children props

父组件Father.jsx

子组件Children.jsx 

猜你喜欢

转载自blog.csdn.net/yxlyttyxlytt/article/details/130816957
今日推荐