Override Default Props: What's wrong?

Override Default Props: What's wrong?
0

#1

Hey all, having trouble with the challenge below. Any ideas what i’m doing wrong?


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

Items.defaultProps = {
  quantity: 0
}

class ShoppingCart extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    { /* change code below this line */ }
    return <Items quantity={100} />
    { /* change code above this line */ }
  }
};

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/override-default-props


#2

You’ve overriden the default quantity to 100, but the questions wants 10. I think that’s it…


#3

Ha ha. That had me worrying. I’m reviewing react. :grinning:


#4

@Danyl007
Just wondering, would you use react to build a pomodoro clock or calculator? It seems like a lot of unnecessary complications. It also adds to load time.


#5

Haven’t got into React yet, only had brief exposure to Angular , which I refer to as ‘the bad time’. My understanding is, the more practise you get with it the better, so I would use React, if only to get better at it. I’m hoping to do small Vue and React course over new years though. Good luck !