how to set Proptypes of object that is not required code example
Example 1: proptypes array of objects
MyComponent.propTypes = {
items: PropTypes.arrayOf(
PropTypes.shape({
code: PropTypes.string,
id: PropTypes.number,
})
),
};
Example 2: react propthpes or
size: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),