Use Default Props -

What is wrong with my code?
Describe your issue in detail here.

 const ShoppingCart = (props) => {

return (


Shopping Cart Component



);
};
// Change code below this line
itemName.defaultProps={
propx: value,
propy: value
};
ShoppingCart.defaultProps = {
items= 0
};


const ShoppingCart = (props) => {
return (
  <div>
    <h1>Shopping Cart Component</h1>
  </div>
);
};
// Change code below this line
itemName.defaultProps = {
prop-x: value,
prop-y: value
}
ShoppingCart.defaultProps = {
items= 0,
};
Chrome

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

Challenge: Use Default Props

Link to the challenge:

HI @BurakCelebi !

Welcome to the forum!

It looks like you tried to copy the sample code from the challenge guide.
But this was just to show you the basic syntax.
This is not the correct answer and needs to be removed from your code.

This is close to the right answer, but you have a syntax error.

Remember to use the correct syntax for an object here

You can also look to the example they gave to fix the syntax error .

MyComponent.defaultProps = { location: 'San Francisco' }

Hope that helps!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.