J'ai respecté la demarche mais ca ne marche toujours pas et j'ai cherché mon erreur et j'ai pas trouvé.Quelqu'un peut m'aider

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

class CampSite extends React.Component {
constructor(props) {
  super(props);
}
render() {
  return (
    <div>
      <Camper/>
    </div>
  );
}
};
Camper.defaultProps = {name: "CamperBot"}
const Camper = props =>
{
return (<p>{props.name}</p>);}
Camper.propTypes = {
name: PropTYpes.string.isRequired
}

// Change code below this line
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Review Using Props with Stateless Functional Components

Link to the challenge:

Hi @dmx1254 !

You first need to define the camper component before you use default props and prop types.

The correct order should be this

//define the camper component first
const Camper = props => {
  return (<p>{props.name}</p>);
}
Camper.defaultProps = { name: "CamperBot" }

Camper.propTypes = {
  name: PropTYpes.string.isRequired
}

The second error is here

The y should not be capitalized.

Hope that helps!

ok d’accord et merci

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.