<Component data={data}>
<Parent data={data} />
[...ChildeComponents]
</Parent>
import React, { Component, cloneElement } from 'react';
export default class Parent extends Component {
render() {
const { data, children } = this.props;
const childrensArray = React.Children.toArray(children);
return (
<div>
{childrensArray.map((children) => cloneElement(children, { data }))}
</div>
);
}
}