Reaccionar propTypes: objectOf vs shape?
Cuál es la diferencia entrePropTypes.objectOf
yPropTypes.shape
? En eldocs:
// 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
})
¿Cuándo debo usar?objectOf
y cuando debo usarshape
?