React: Review Using Props with Stateless Functional Components

Hi! This is my challenge https://learn.freecodecamp.org/front-end-libraries/react/review-using-props-with-stateless-functional-components

Why this code is not valid?

class CampSite extends React.Component {
constructor(props) {
super(props);
}
render() {
return (




);
}
};
const Camper = (props) => {
return (

{props.name}

) }

Camper.defaultProps = {
name: “CamperBot”
}

Camper.PropTypes = {
name: PropTypes.string
}

You shouldn’t be changing the CampSite component—it should be returning the Camper component as it was set up to. I suggest that you keep a copy of your current code and rest the lesson.

In addition, there are a few other issues with your code:

  • Your Camper component is not returning what the instructions ask you to (see the highlighted part):

    Inside the Camper component, render any code that you want, but make sure to have one p element that includes only the name value that is passed in as a prop.

  • There is a typo where you define propTypes, it should be Camper.propTypes instead of Camper.PropTypes.

There is one more thing that’s missing but the tests will tell you what’s wrong. Good luck!

Your:
render(){
Return(
// #Cannot be empty here…
)
}
Cannot be empty for react to render, you need to insert a null, or a

tag inside the return statement for the code to run.