I like to set empty array and object variables as false, I feel like it makes my code (!messier). I was wondering if there was a way to validate a finite set of prop types. Something like this:
const propTypes = {
example: PropTypes.oneOf([PropTypes.array, PropTypes.bool]).isRequired
}
I don't mind being told why this is a bad idea, I appreciate all the constructive comments.
Better way is set
array
(object
) asnull
.