Hey, I'm trying to run some side effects like logging when field state is changing after validation. I use mobx reactions (maybe there are better options) to observe isValid property and react on it:
const logger = reaction(
() => this.props.field.isValid,
isValid => {
const { name } = this.props.field;
LoggerService(`${name} status: ${isValid ? LoggerStatus.ValueOk : LoggerStatus.ValueError}`);
}
);
Works perfectly fine but on form submit some kind of validation reset is happening:
field1 status: ok
field1 status: error
field2 status: ok
field2 status: error
Whereas I prefer to get actual field state on submit:
field1 status: error
field2 status: error
I suspect I'm doing something wrong, maybe you can suggest a better solution?
Thanks!
Hey, I'm trying to run some side effects like logging when field state is changing after validation. I use
mobxreactions (maybe there are better options) to observeisValidproperty and react on it:Works perfectly fine but on form submit some kind of validation reset is happening:
Whereas I prefer to get actual field state on submit:
I suspect I'm doing something wrong, maybe you can suggest a better solution?
Thanks!