I like the look of this, but I feel like they're being disingenuous with the way they present their examples. They are making a statement saying "less lines of code is good", using a Formik example that writes:
function validateUsername(value) {
let error;
if (value === "admin") {
error = "Nice try!";
}
return error;
}
Whereas with their library they write:
validate: value => value !== "admin" || "Nice try!"
I understand that they say "this is taken from the official documentation" but if that's the case they need to use the same coding style for their own examples to be able to make a fair comparison.
9
u/AiexReddit Mar 03 '20 edited Mar 04 '20
I like the look of this, but I feel like they're being disingenuous with the way they present their examples. They are making a statement saying "less lines of code is good", using a Formik example that writes:
Whereas with their library they write:
I understand that they say "this is taken from the official documentation" but if that's the case they need to use the same coding style for their own examples to be able to make a fair comparison.