React defaultProps not working
Initially, my
field
prop is an empty object.
Default props are only used if no value is passed for the prop. It is is shallow merge, not a deep merge.
From the docs (emphasis mine):
The result of
getDefaultProps()
will be cached and used to ensure thatthis.props.value
will have a value if it was not specified by the parent component.