compare
Last updated
Was this helpful?
Last updated
Was this helpful?
The compare
validator is quite similar to the letter validator we've built in our examples.
If the value being validated is null
, false
, an empty string, or another falsy value other than 0
, then the result will be valid. This respects the rule of thumb described in the notes for the validator.
compare
: The value compared against
The compare
validator supports three parameter signatures:
compare(value)
where the value is used as the compare
named prop
compare(propsObject)
where the props object contains a compare
named prop
compare(propsFunction)
where the props function returns a props object with a compare
named prop