Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (child.type === Form.Field) {
const name = child.props.name;
let error = this.state.formErrors ? this.state.formErrors[name] : null;
let clonedElement = child;
if (error) {
error = error[0]
? error[0].message.replace(name, child.props.label)
: null;
clonedElement = React.cloneElement(child, {
errorText: error
});
}
return React.cloneElement(clonedElement, {
events: ["onBlur"]
});
} else if (child.type === Form.Button) {
return React.cloneElement(child, {
component: GSSubmitButton,
isSubmitting: this.state.isSubmitting
});
} else if (child.props && child.props.children) {
return React.cloneElement(child, {
children: this.renderChildren(child.props.children)
});
}
return child;
});
}