Review Using Props with Stateless Functional Components - require is not defined

Review Using Props with Stateless Functional Components - require is not defined
0

#1

Tell us what’s happening:

I am lost! Even after searching for solutions, I don’t understand the error.

Your code so far


import PropTypes from 'prop-types';

class CampSite extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      name: ""
    }
  }
  render() {
    return (
      <div>
        <Camper name="Geoffrey" />
      </div>
    );
  }
};
// change code below this line
class Camper extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <p>{this.props.name}</p>
      </div>
    );
  }
};

Camper.defaultProps = {
	name:  "CamperBot"
};

Camper.propTypes = {
	name: PropTypes.string.isRequired
};

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/review-using-props-with-stateless-functional-components


#2

You don’t need to import proptypes yourself.

It’s already been done behind the scene.


#3

Man, that test failure message could be 1000x more helpful if it just said that!