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.


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


Use get function from the resolver parameters to reference other fields' props.

export default {
  name: {
    confirmPassword: ({ get, value }) => {
      return value === get(['password', 'value'])

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).

Last updated