I\'m trying to find the proper way to define some components which could be used in a generic way:
Some reason React.children was not working for me. This is what worked for me.
I wanted to just add a class to the child. similar to changing a prop
var newChildren = this.props.children.map((child) => {
const className = "MenuTooltip-item " + child.props.className;
return React.cloneElement(child, { className });
});
return {newChildren};
The trick here is the React.cloneElement. You can pass any prop in a similar manner