Was ist der Unterschied zwischen PropTypes.objectOf
und PropTypes.shape
? In den Dokumenten :
// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number)
vs.
// An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
color: PropTypes.string,
fontSize: PropTypes.number
})
Wann soll ich verwenden objectOf
und wann soll ich verwenden shape
?
PropTypes.objectOf
?