GX2005: attribute spread on a component
{...expr} puts attributes on an HTML element only.
Cause
{...expr} puts attributes on an HTML element only. A component does not take attributes that it does not declare.
Example
package card
props {
Title string
}
<article>{p.Title}</article>package card
props {
Attrs gx.Attrs = nil
}
<Card title="News" {...p.Attrs} />gx check reports:
ui/card/Page.gx:7:20: GX2005: attributes cannot spread onto <Card>; pass a gx.Attrs prop insteadFix
- Give the component a prop of type
gx.Attrs. - Pass the attributes to that prop, for example
attrs={p.Attrs}.