You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just had a thought. If a known boolean attribute gets assigned a true variable as in my example, JSX should output just the attribute as per the spec. If we assign a string to a boolean attribute, it can output an attribute with a value.
This is how I've been conditionally putting the
disabled
attribute on elements, with a boolean variable:When
disabled
is falsey, the attribute won't be added. When true, it will output the following, which works in browsers but is against the HTML5 spec:I could get in line with the spec by setting
disabled="disabled"
on the element, but that requires a ternary operation instead of a boolean:Ideally, my current bit of JSX (at the top of this issue) would output this HTML, assuming
disabled
is set to true:The text was updated successfully, but these errors were encountered: