Skip to content

Instantly share code, notes, and snippets.

@hugufc
Last active May 22, 2018 23:41
Show Gist options
  • Save hugufc/b31aa97df0f5c4d24f2dfceb68ea4acb to your computer and use it in GitHub Desktop.
Save hugufc/b31aa97df0f5c4d24f2dfceb68ea4acb to your computer and use it in GitHub Desktop.
Expose wrapped element
{React.Children.map(props.children, element => {
if (!React.isValidElement(element)) {
return;
}
if (element.type.prototype && element.type.prototype.isReactComponent) {
var instance = new element.type(element.props);
return instance.render();
}
return element.type(element.props);
})}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment