Use empty default object

Looks as if the having one of these objects as the default causes overwriting in some way, as opposed to augmentation. Have the source object be an empty one, so that it gets the attributes of both defaults and props. Fixes #642.
This commit is contained in:
Matthew Taylor 2016-06-30 16:52:46 -04:00
parent 5b288e4d3e
commit 6db426a586

View file

@ -29,8 +29,9 @@ module.exports.validationHOCFactory = function (defaultValidationErrors) {
var ValidatedComponent = React.createClass({
render: function () {
var validationErrors = defaults(
this.props.validationErrors,
defaultValidationErrors
{},
defaultValidationErrors,
this.props.validationErrors
);
return (
<Component {...this.props} validationErrors={validationErrors} />