Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/ValidatedInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ export default class ValidatedInput extends React.Component {
constructor(props) {
super(props);

const {validationEvent, validate, errorHelp, _registerInput, _unregisterInput, ...inputProps} = props;
const {validationEvent, validate, errorHelp, _registerInput, _unregisterInput, ...rest} = props;
this._registerInput = _registerInput;
this._unregisterInput = _unregisterInput;
this.inputProps = inputProps;
if (!this._registerInput || !this._unregisterInput) {
throw new Error('Input must be placed inside the Form component');
}
Expand All @@ -23,7 +22,9 @@ export default class ValidatedInput extends React.Component {
}

render() {
return <FormControl ref='control' {...this.inputProps}>{this.props.children}</FormControl>;
// Capture props at time of render and strip local component data.
const {validationEvent, validate, errorHelp, _registerInput, _unregisterInput, ...inputProps} = this.props;
return <FormControl ref='control' {...inputProps}>{this.props.children}</FormControl>;
}
}

Expand Down