Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CardGroup extends Component {
- render() {
- return (
- <div>{this.props.children}</div>
- )
- }
- }
- 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
- }
- }
Add Comment
Please, Sign In to add comment