mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-26 08:42:03 +05:30
* Probably fixes #23 * Track field errors from state only The previous commit has moved error storage to state so it isn't necessary to check for error in props anymore. * Undo state initialization from props
This commit is contained in:
parent
74f04e9080
commit
4265b37543
@ -15,18 +15,8 @@ export default class FormInputComponent<P, S = {}> extends FormComponent<
|
||||
error?: Error;
|
||||
}
|
||||
> {
|
||||
componentDidUpdate() {
|
||||
if (this.state && this.state.error) {
|
||||
this.setState({
|
||||
error: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
renderError() {
|
||||
const error = (this.state && this.state.error) || this.props.error;
|
||||
|
||||
return <FormError error={error} />;
|
||||
return <FormError error={this.state?.error || this.props.error} />;
|
||||
}
|
||||
|
||||
setError(error: Error) {
|
||||
|
Loading…
Reference in New Issue
Block a user