PropTypes.objectOf和之间有什么区别PropTypes.shape?在文档中:
// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number)
Run Code Online (Sandbox Code Playgroud)
VS
// An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
color: PropTypes.string,
fontSize: PropTypes.number
})
Run Code Online (Sandbox Code Playgroud)
我objectOf应该何时使用,何时使用shape?