We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unit
Given this code:
<button disabled={()}> "my button" </button>
To have a button that isn't disabled, I have to duplicate the code logic or use pure function syntax instead of doing it directly in JSX syntax.
Update: This is a very awkward Button component that were written to allow this:
Button
module Button = { open Tyxml.Html; let createElement = (~title=?, ~cls=?, ~disabled=?, ~children, ()) => { let a = { let or_append = (value, cb, attrs) => { switch (value) { | None => attrs | Some(value) => [cb(value), ...attrs] }; }; let attrs = []; let attrs = attrs |> or_append(title, title => a_title(title)) |> or_append(cls, cls => a_class(cls)); let attrs = switch (disabled) { | Some(true) => [a_disabled(), ...attrs] | Some(false) | None => attrs }; attrs; }; button(~a, children); }; };
The text was updated successfully, but these errors were encountered:
I agree this is quite inconvenient, but I'm not sure I have a satisfying solution.
We could turn all the unit taking attributes into boolean ones. This is a slight departure from the spec, but maybe a reasonable one.
Sorry, something went wrong.
No branches or pull requests
Given this code:
To have a button that isn't disabled, I have to duplicate the code logic or use pure function syntax instead of doing it directly in JSX syntax.
Update: This is a very awkward
Button
component that were written to allow this:The text was updated successfully, but these errors were encountered: