jquense / uncontrollable

Wrap a controlled react component, to allow specific prop/handler pairs to be uncontrolled
MIT License
199 stars 33 forks source link

When logging child.props for an uncontrollable component from a parent, defaultProps are not present #25

Open aanguswilliams opened 7 years ago

aanguswilliams commented 7 years ago

Applying defaultProps to the source or wrapped uncontrollable components does work, but if you examine the child props from a parent component, the defaultProps aren't present. Not sure what the best way to explain this is, here's a contrived example:

UncontrollableComponent.defaultProps = {
    defaultProp: "thisDoesNotShow"
}

<ParentThatExaminesChildren>
    <UncontrollableComponent explicitProp="thisShows"/>
</ParentThatExaminesChildren>

// child.props from parent only logs {explicitProp: "thisShows"}

Is this expected behaviour?