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
Use the property format (e.g. className instead of class), or use renderedCallback to manually call setAttribute() on the element.
Potential solution
This would be an overhaul of how lwc:spread currently works and would have the potential for backwards-incompatible breakages. For the time being, though, this issue can at least serve as documentation about the current behavior.
The text was updated successfully, but these errors were encountered:
For context, this behavior is by design. I recall having a dev sync discussion where the outcome was to keep it as simple as possible and to avoid any special handling.
Description
lwc:spread
applies property names to an element (similar toObject.assign()
), but not attributes, which may be unexpected.For example, a developer might assume that this will render as
class="red"
:However, it does not. Instead, you must use
className
:Similarly, you cannot apply attributes that do not have a property equivalent:
Steps to Reproduce
See repro
Potential workaround
Use the property format (e.g.
className
instead ofclass
), or userenderedCallback
to manually callsetAttribute()
on the element.Potential solution
This would be an overhaul of how
lwc:spread
currently works and would have the potential for backwards-incompatible breakages. For the time being, though, this issue can at least serve as documentation about the current behavior.The text was updated successfully, but these errors were encountered: