Override Default Props

Override Default Props
0.0 0

#1

Tell us what’s happening:
Hi, i’m new to react.
Is this how you override defaultProps? Although it changes the quantity but it does not pass the test.

Your code so far


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 */ }
     Items.defaultProps={ quantity:10 }
    return <Items />
   
    { /* change code above this line */ }
  }
};

Your browser information:

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

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


#2

You want to set the quantity = {10} inside the component within ShoppingCart

so:

return (
arrow Items quantity = {10} dash + arrow
)