Reputation: 39028
With the following code I can check the type of the incoming props, however how do I check the internals of each object inside of the array assets?
AssetsTable.propTypes = {
assets: PropTypes.array.isRequired
}
Say for example if I wanted to check assets[0].id: PropTypes.string.isRequired
Upvotes: 0
Views: 412
Reputation: 9458
I think you can do something like
React.PropTypes.arrayOf(
React.PropTypes.shape({
id: React.PropTypes.string.isRequired
})
).isRequired
see here for more information
Upvotes: 4