News for hackers. Stuff that matters.
Re:HTML Form Validation is heavily underused by Etheryte on Monday October 28, 2024 @07:29PM (#41977693)
They've used `required={true}`, not `required="true"`, which is JSX, not HTML. The one with curlies isn't even valid HTML. In the old HTML spec, the correct value, if you wanted to set a value, was to set `required="required"`, but these days the spec is looser since it tries to conform to the web, not the other way around.
Re:HTML Form Validation is heavily underused by joshchernoff on Monday October 28, 2024 @07:41PM (#41977784)
Even in jsx its not required to add a boolean value. Unless you are passing in a var as a prop in which case sure. But that didn't look like it was the case in these examples.
Re:HTML Form Validation is heavily underused by ervine on Monday October 28, 2024 @08:14PM (#41978018)
One of my favorite eslint rules to enable: https://github.com/jsx-eslint/eslint-plugin-react/blob/maste...
Re:HTML Form Validation is heavily underused by everdimension on Tuesday October 29, 2024 @10:01AM (#41983929)
> Even in jsx its not required to add a boolean value

Absolutely true! But I like to do it because I personally think it reads more nicely and is more explicit and that's what I do in all my projects. But it is indeed a matter of taste and I have nothing against code that follows the convention to omit the "true" value.