Override-default-props

Override-default-props
0

#1

Tell us what’s happening:

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() {
  return <Items props={ quantity: {10} } />

  }
};

// ReactDOM.render(
//   <ShoppingCart />,
//   document.getElementById("challenge-node")
// );

Your browser information:

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

Link to the challenge:


#2

The way you are passing props is not correct, that’s why the tests are failing. When you are passing props the name of the prop is on the left of the = sign and the value on the right, so you are passing a prop called props.

Go back to this lesson to see how you can pass quantity in as a prop: https://beta.freecodecamp.org/en/challenges/react/pass-props-to-a-stateless-functional-component