Closed YM-KA closed 5 years ago
I could add an isValidParams method to the Location that you could use to conditionally render the link, or something else when invalid.
Thank you for the prompt reply! Yes, please - that would be fantastic! 👍
Implemented in v1.2.0, now on npm.
Many thanks, works like a charm!
When generating links by iterating data it would sometimes be preferred to be able tom omit links that do not match the schema. Now the whole page breaks with giving an error along the lines of "Warning: validateParams: id must match the following:"/-\w{19}/". See code excerpt below.
If any single link fails validation the entire page breaks. The error stack shows:
to
is marked as required inLink
, but its value isnull
.Alternatively - would it be possible to define a default value that gets presented when validation fails?
Kind regards Kazuyuki