react pass props to this.props.children
/**
* pass props to this.props.children
* see http://stackoverflow.com/questions/32370994/how-to-pass-props-to-this-props-children
*/
const childrenWithProps = React.Children.map(this.props.children,
(child) => React.cloneElement(child, {
onGo: (value) => {
// invoke child onGo event (if any)
if (child.props.onGo) {
child.props.onGo(value);
}
// do our own logic
this.enterResultMode();
}
})
);