Tell us what’s happening:
i don’t know what i need to do.
Your code so far
const Items = (props) => {
return <h1>Current Quantity of Items in Cart: {props.quantity}</h1>
};
import PropTypes from 'prop-types';
Items.propTypes = {
quantity: PropTypes.number.isRequired
};
Items.defaultProps = {
quantity: 0
};
class ShoppingCart extends React.Component {
constructor(props) {
super(props);
this.state = { quantity: 5 }; // o cualquier cantidad inicial
}
render() {
return <Items quantity={this.state.quantity} />
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0
Challenge Information:
React - Use PropTypes to Define the Props You Expect