Review Using Props with Stateless Functional Components, giving me this error: {Uncaught ReferenceError: require is not defined}

import PropTypes from 'prop-types';

class CampSite extends React.Component {

  constructor(props) {

    super(props);

  }

  render() {

    return (

      <div>

        <Camper />

      </div>

    );

  }

};

// Change code below this line

const Camper = (props) => {

  return <p>{props.name}</p>

};

Camper.defaultProps = {

  name: "CamperBot"

};

Camper.propTypes = {

  name: PropTypes.string.Isrequired

};

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Please provide a link to the challenge.

thank you kevin,
link is here

Remove the import at the top. Ordinarily you would have to do something like that, but because we are in the FCC sandbox, we are confusing it.

When I remove that and fix a capitalization issue with your prop type, this passes for me.

thanks kevin, it passed.

1 Like

function Camper(props) {
return(

{props.name}


)
}

Camper.defaultProps = {
name: “CamperBot”
};

Camper.propTypes = {
name: PropTypes.string.isRequired
};