Use PropTypes to Define the Props You Expect

Hi everyone
I’m just curious to know why this code works
check line 7 and line 20

Because there is nothing wrong with the code.

Prop types will usually alert you via the console when a prop type is invalid rather than on the page itself.

Ok So was thinking because the default props is required to be a number why does it accept a string as input?

Please can you check line 8 it’s give an error because 10 is not a string

It’s giving an error because you didn’t wrap it in { }

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