Tell us what’s happening:
I am wondering why my console is telling me that ‘name’ is not defined even though i have named defined in my Camper component.
Is it becuase the challenge says ‘functional components’ so it needs to be a function compnenet and not a class? would this work if it was not a challenge?
**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 (
<div>
<p>{this.props.name}</p>
</div>
)
}
}
Camper.defaultProps = {name:'CamperBot'};
Camper.propTypes.name = {name:PropTypes.string.isRequired}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Edg/98.0.1108.56
Challenge: Review Using Props with Stateless Functional Components
Link to the challenge: