gaggan
#1
Tell us what’s happening:
When I run my code, my console give me an error that
Uncaught ReferenceError: React is not defined
Then I added react by :
import React from 'react’
Now console error changed to :
Uncaught ReferenceError: require is not defined
Your code so far
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 />
}
};
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36
.
Challenge: Use PropTypes to Define the Props You Expect
Link to the challenge:
https://www.freecodecamp.org/learn/front-end-libraries/react/use-proptypes-to-define-the-props-you-expect
In what environment are you running this?
gaggan
#3
Thank you for replying.
I’m running this inside default freecodecamp sandbox. It’s one of the react exercise.
This is link to the exercise:>
https://www.freecodecamp.org/learn/front-end-libraries/react/use-proptypes-to-define-the-props-you-expect
Sorry, I misunderstood.
When I cut and pasted your code into the challenge, it passed for me.
What browser are you using? I would recommend Chrome. Reboot, try a different browser, clear your browser cache. “Reset All Code” and try again.
1 Like
Do you see any errors showing in the browser console (not the FCC console)? If you do, please report back to us with a screenshot.
1 Like
gaggan
#6
I’m using chrome. I’ve tried clearing cache, rebooting and resetting my code.
I’m getting the same errors in the browser console. Screenshot attached.
Thanks for your time
gaggan
#7
I just solved this issue by disabling Pi-hole on my raspberry pi.
Pi-hole was somehow causing connection problems .
Thank you again 