GX6003: widget tag is missing, not valid or used two times
A gx.Widget has no Tag, has a tag that is not a custom element name, or has the tag of a different widget.
Cause
A gx.Widget has no Tag, has a tag that is not a custom element name, or has the tag of a different widget. The tag is the element name that a host page writes, for example <acme-cart>. The browser accepts a custom element name only when it starts with a lowercase letter and has a hyphen.
Example
package cart
props {
Currency string
}
<section>
<p>Your cart in {p.Currency}</p>
</section>package route
import "github.com/alternayte/gx"
type Widget struct {
gx.Route `GET /widgets/cart`
Currency string `query:"currency" default:"EUR"`
}package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var CartWidget = gx.Widget(func(c *gx.Ctx, in route.Widget) (CartProps, error) {
return CartProps{Currency: in.Currency}, nil
}, Cart).Tag("cart")
var Routes = gx.Collect(CartWidget)gx check reports:
cart/cart.go:10:14: GX6003: widget tag "cart" is not a custom element name: the name must have a hyphenFix
- Give the widget a name with a hyphen:
.Tag("acme-cart"). A prefix of your company or product keeps the name different from the elements of the host. - Give each widget of the app its own tag.