Ayyy 2 posts in 1 day, i’m on a roll. So i’ve had 2 other coders look at this, and wrote it in 2 different ways, all coming up with the same error:
“The Camper component should include prop types which require the name prop to be of type string.”
Everything else is passing. Not to mention the syntax for that error is “Camper.PropTypes = {name: PropTypes.string.isRequired};”
So whats going on here?
Your code so far
class CampSite extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<Camper/>
</div>
);
}
};
// change code below this line
class Camper extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<p>
{this.props.name}
</p>
);
}
}
Camper.PropTypes = {name: PropTypes.string.isRequired};
Camper.defaultProps = {name: 'CamperBot'};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/review-using-props-with-stateless-functional-components