Reactive rule
Any validation resolver may become reactive. This means that it is being re-evaluated anytime the field prop references established in its declaration change.

Definition

1
type Get = (fieldPropPath: string[]) => any
Copied!

Declaration

Use get function from the resolver parameters to reference other fields' props.
validation/rules.js
1
export default {
2
name: {
3
confirmPassword: ({ get, value }) => {
4
return value === get(['password', 'value'])
5
}
6
}
7
}
Copied!
The resolver above marks confirmPassword field as valid whenever its value equals to the value of the password field. This rule is automatically re-evaluated in real time whenever the values of either fields update.
Use reactive rules when the validity of a field depends on some props of another field(s).
Copy link