Skip to content

Make validate module great again #35

@dmitry-korolev

Description

@dmitry-korolev

Currently, stapp-validate accepts only a static set of validation rules. Sometimes rules have to be created dynamically, and providing an application's state to the rule itself doesn't solve the issue.

Solution
rules field of a configuration object should accept a function:

type ValidateConfig<State> = {
+  rules: ValidationRules<State> | (state: State) => ValidationRules<State>
-  rules: ValidationRules<State>
  validateOnInit?: boolean
  setTouchedOnSubmit?: boolean
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions