I have a Card component and a CardGroup component, and I\'d like to throw an error when CardGroup has children that aren\'t Card
Card
CardGroup
static propTypes = { children : (props, propName, componentName) => { const prop = props[propName]; return React.Children .toArray(prop) .find(child => child.type !== Card) && new Error(`${componentName} only accepts "" elements`); }, }