Good evening, I’m in this challenge and I do not understand why it does not pass the test, it says that propTypes is not defined and nothing comes up on the screen: https://learn.freecodecamp.org/front-end-libraries/react/use-proptypes -to-define-the-props-you-expect /
Thank you!
It’d be really heplfull if you post the code showing what you already tried to do. Also the link to the challenge is not working, it says not found.
jenovs
February 13, 2019, 7:30pm
3
It’s probably because you’re mixing PropTypes
and propTypes
Sorry the challenge is this:
React: Use PropTypes to Define the Props You Expect.
And this is my code:
const Items = (props) => {
return <h1> Current Quantity of Items in Cart: {props.quantity} </ h1>
};
// change code below this line
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 />
}
};
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
Note: Backticks are not single quotes.
1 Like
Thank you very much, I’ll keep it in mind for the next time. On the other hand I have already solved the challenge
Would you be able to post your solution in case other campers find the same problem?
1 Like
Without any problem ! Now I upload it