Override Default Props (NOT WORKING)

Tell us what’s happening:
Why is this not working?
Describe your issue in detail here.

  **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 quantity={50}/>
  { /* 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/91.0.4472.77 Safari/537.36

Challenge: Override Default Props

Link to the challenge:

render() {
  { /* Change code below this line */ }
 <Items quantity={50}/> //you nee to return in your render
  { /* Change code above this line */ }
}
};

Change your code, so that quantity={10}

I hope this helps.

I really recommend practicing describing what is wrong with your code. Professional developers constantly need to research topics and ask questions to their peers. Learning how describe your problems so that you can research answers and communicate with others is a critical skill that needs practice to develop.

2 Likes

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