Use PropTypes to Define the Props You Expect: cannot pass the test

Tell us what’s happening:
Basically, I get the following message with the code as poted below:

The Items component should include a propTypes check that requires quantity to be a number.

If I add the import statement, I get “require is not defined”

If I write it as React.PropTypes.number.isRequired, I get “cannot read property of undefined”.

I tried switching browsers.

Any ideas?

Thanks!

Your code so far


const Items = (props) => {
  return <h1>Current Quantity of Items in Cart: {props.quantity}</h1>
};

// change code below this line
Items.propTypes = { quantity:
PropTypes.number.isRequired }
// change code above this line

Items.defaultProps = {
  quantity: 0
};

class ShoppingCart extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return <Items />
  }
};

Your browser information:

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

Link to the challenge:

You won’t need an import statement.

Just make sure it’s one line instead of two lines. :sunglasses:

Oh my God :sweat:
Thanks so much!!