What is a static property?


#1

Question

In the context of this exercise, we learned that propTypes can be set as a static property of a component class. What is a static property?

Answer

A static property is one that applies to a class, but not to any instance of the class. As a result, there is just one copy of a static property, rather than one copy of the property for each instance.

When applying propTypes, it is a static property of a component class. We only need to set the propTypes once to the class, and every instance we create will be able to refer to that.


FAQ: PropTypes - Apply PropTypes