Use PropTypes to Define the Props You Expect - suggestion?

Use PropTypes to Define the Props You Expect - suggestion?
0.0 0

#1

Tell us what’s happening:
Last pass isn’t passing: The Items component should include a propTypes check that requires quantity to be a number.

Help appreciated!

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 = { 
  number: 
  PropTypes.number.isRequired 
 };


// change code above this line

Items.defaultProps = {
  quantity:0
};

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/use-proptypes-to-define-the-props-you-expect


#2

The challenge says quantity, not number: just a typo :slight_smile:
Remove the space/ newline too, unnecessary ones creates problems to the tester^^