react proptypes for object property code example
Example 1: proptypes objectof
Component.propTypes = {
booleanObjectProp: PropTypes.objectOf(
PropTypes.bool
),
multipleObjectProp: PropTypes.objectOf(
PropTypes.oneOfType([
PropType.func,
PropType.number,
PropType.string,
PropType.instanceOf(Person)
])
)
}
Example 2: react propthpes or
size: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),