if I try to set a proptype as PropTypes.element
, not required, what is the proper default?
static propTypes = {
expandable: PropTypes.bool,
popover: PropTypes.element,
}
static defaultProps = {
expandable: false,
popover: () => {},
}
Thanks
The proper default, or non existing component, in React is
null
. You can use it inrender()
like that:or simply define it in staticProps:
The default value could be:
I think
undefined
should work.