I know that is it considered a good practice to name react component by adding a displayName property, but not sure I know why. In react docs, it say:
this article helped me:
How do I get string name of React Native component class?
class CardGroup extends Component {
render() {
return (
{this.props.children}
)
}
}
CardGroup.propTypes = {
children: function (props, propName, componentName) {
const prop = props[propName]
let error = null
React.Children.forEach(prop, function (child) {
if (child.type !== Card) {
error = new Error('`' + componentName + '` children should be of type `Card`.');
}
})
return error
}
}