Guest User

Untitled

a guest
Dec 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class CardGroup extends Component {
  2. render() {
  3. return (
  4. <div>{this.props.children}</div>
  5. )
  6. }
  7. }
  8. CardGroup.propTypes = {
  9. children: function (props, propName, componentName) {
  10. const prop = props[propName]
  11.  
  12. let error = null
  13. React.Children.forEach(prop, function (child) {
  14. if (child.type !== Card) {
  15. error = new Error('`' + componentName + '` children should be of type `Card`.');
  16. }
  17. })
  18. return error
  19. }
  20. }
Add Comment
Please, Sign In to add comment