Tell us what’s happening:
Initially I received an error saying that propTypes is not defined.
I was able to fix this by using the import on line 6
Currently I’m getting an error saying that require is not defined either, but I’m unsure where this would be found in the exercise. I tried adding “require” to the curly braces of the import and still get the same error. Where should it be defined? It seems like a version issue, but I just don’t know how to fix it in the context of this exercise.
Your code so far
const Items = (props) => {
return <h1>Current Quantity of Items in Cart: {props.quantity}</h1>
};
// change code below this line
import React, { propTypes } from 'react';
Items.propTypes = {
quantity: propTypes.number.isRequired
};
// change code above this line
Items.defaultProps = {
quantity: 0
};
class ShoppingCart extends React.Component {
constructor(props) {
super(props);
}
render() {
return <Items />
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge: