Does this Page have a Bug?


#1


https://www.codecademy.com/en/courses/react-102/lessons/proptypes/exercises/proptypes-stateless?user_id=579c355e9ad7f55240000004


Will not produce any corrective instruction at al. Could be a bug as suggested before, does not operate like any other page on Codecademy


var React = require('react');

function GuineaPigs (props) {
return <h1>{GuineaPigs.message}</h1>;
}

  GuinePigs.propTypes = {
  message: React.PropTypes.string.isRequired
  };

    <div>
      <h1>Cute Guinea Pigs</h1>
      <img src={src} />
    </div>
  );
}

module.exports = GuineaPigs;


#2

I'm stuck on this one as well. The propType refers to a string in an array. I've tried all propTypes though - no luck.
Also, in this example I think they expect the propType to be be declared outside of the function. Here's my code (it doesn't pass):

var React = require('react');

function GuineaPigs (props) {
  var src = props.src;
  return (
       <div>
        <h1>Cute Guinea Pigs</h1>
        <img src={src} />
      </div>
  );
}
GuinePigs.propTypes = {
  src: 
  React.PropTypes.string.isRequired
};

module.exports = GuineaPigs;

#3

This one passes for me:

var React = require('react');

function GuineaPigs (props) {
  return (
  <div>
        <h1>Cute Guinea Pigs</h1>
        <img src={props.src} />
      </div>
  )
};

GuineaPigs.propTypes = {
  src: React.PropTypes.string.isRequired
};

module.exports = GuineaPigs;

#4

Thanks! Worked for me too, after a bit of fiddling (the editor didn't like it when I left a space between the function declaration and the return statement)


#5

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