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
Attributes should be the only way in which we pass data into tags (except for a few exceptions like if and for). The spread attribute is soon to be a JS standard and has a major benefit over the current solutions: order matters.
Using the parens as a tag argument (<custom-tag(input.attrs)/>) prevents you from ordering and even <custom-tag ${input.attrs}/> which could support ordering, doesn't.
Ordering gives you the ability to assign precedence, to create both default values and override values.
<custom-tagfoo="default" ...inputbar="override"/>
As a side note, the parens as an argument don't work for regular dom tags.
// no matter what `input.attrs` is, all you get is `<div data-foo>`
<div(input.attrs)data-foo=input.foo/>
The text was updated successfully, but these errors were encountered:
New Feature
Description
Support the spread operator in tag attributes.
Why
We currently support two ways of passing dynamic attributes to a tag:
Attributes should be the only way in which we pass data into tags (except for a few exceptions like
if
andfor
). The spread attribute is soon to be a JS standard and has a major benefit over the current solutions: order matters.Using the parens as a tag argument (
<custom-tag(input.attrs)/>
) prevents you from ordering and even<custom-tag ${input.attrs}/>
which could support ordering, doesn't.Ordering gives you the ability to assign precedence, to create both default values and override values.
As a side note, the parens as an argument don't work for regular dom tags.
The text was updated successfully, but these errors were encountered: