import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Challenge from './Challenge.jsx'; const propTypes = { challenges: PropTypes.array.isRequired }; export default class Challenges extends Component { shouldComponentUpdate(nextProps) { return this.props.challenges !== nextProps.challenges; } render() { const { challenges } = this.props; if (!challenges.length) { return
No Challenges Found
; } return (
{ challenges.map(dashedName => ( )) }
); } } Challenges.displayName = 'Challenges'; Challenges.propTypes = propTypes;