Just wanted to provide an example given the following object:
{
petStore: {
animals: {
'23': { name: 'Snuffles', type: 'dog', age 13 }
'29': { name: 'Mittens', type: 'cat', age: 7 }
}
}
}
ObjectOf and form
Used when an object can have different property names, but a consistent set of properties for each of them:
const animalItemShape = {
name: PropTypes.string,
type: PropTypes.string,
age: PropTypes.number
}
const petStoreShape = {
animals: PropTypes.objectOf(PropTypes.shape(animalItemShape))
}
, animals - , , animalItemShape.
, !