V
V
Vann Damm2021-03-04 10:28:09
React
Vann Damm, 2021-03-04 10:28:09

How to validate errors with redux-form selectors?

I get error errors from the form state with this selector.

let LoginWithFormState = reduxForm<LogInFormDataType, FormPropsType>({ form: "login",touchOnChange:true})(Login);
//@ts-ignore
LoginWithFormState = connect(
  (state:any) =>
  ({
    synchronousError : getFormSyncErrors('login')(state)
  }) 
)(LoginWithFormState);


export default LoginWithFormState;

The problem with how it works is that on the first render, fields that are "Required" are marked with an error, even though it's worth autocomplete, oh well, this can be bypassed. But when clicking on any part of the screen, the state of the errors is already changing, and they are no longer Required (no errors), i.e. autocomplete is filled only after clicking on any of the parts of the screen. And I haven't started typing yet. Maybe there is a recipe how to solve it correctly?
60408a1cb1c01890417520.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question