Can we do it like this?

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>
  );
}
};
// Change code below this line

const Camper = function (props) {
  Camper.propTypes = {
    name: PropTypes.string.isRequired,
  }

  return (
    <div>
      <p>{props.name}</p>
    </div>
  )
}

Camper.defaultProps = {
  name: 'CamperBot'
}
  **Your browser information:**

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

Challenge: Review Using Props with Stateless Functional Components

Link to the challenge:

Can you explain what you mean by “this”?

The exercise
If we can do it with functions

Cn you explain what you mean? ‘Do it with functions’ isn’t really clear.

Yes, please get better at describing your issue. That is an important part of being a developer. And sometimes in describing the problem, you end up finding a solution.

I’m going to assume that you’re asking if you can use functional components instead of class components?

Is that what you are asking? Are you asking in terms of React in general? In terms of FCC? In terms of this specific challenge?

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