React: Review Using Props with Stateless Functional Components

React: Review Using Props with Stateless Functional Components
0.0 0


Hi! This is my challenge

Why this code is not valid?

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

const Camper = (props) => {
return (


) }

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!


// #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.