I’m litle confuse with this line of code: Why one ‘p’ and one ‘P’ ?
Because they are different things.
Left one is a method which you define for
MyComponent. Right one refers to a class, which are written with a capital-letter (to differentiate them from methods, function, variable…), the same way you started
MyComponent with a capital letter. Meanwhile the handleClick is also written lowercase because it’s not a class - and so is
.func.isRequired because both are attributes of
PropTypes (or maybe functions - I dunno what any of these things do, just that classes are written capitalized).
You just give them the same name because the whatever exactly the method does, is directly linked to the use of the class.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.