If I have a component that its propTypes are the following
import React, { Component } from 'react'
import propTypes from 'prop-types'
class MyComponent extends Component {
///
}
MyComponent.propTypes = {
hidden: propTypes.string.isRequired,
items: propTypes.object,
attributes: propTypes.array
}
MyComponent.defaultProps = {
hidden: false,
items: {},
attributes: ['baz', 'qux']
}
If my component is called like this
<MyComponent hidden={true} items={[value: 'foo', label: 'bar']} />
I would like to expect that props.attributes is populated with the defaultProps values since it's value is not defined. Is this something that can be achieved (easily)?