-
-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
Is it possible to change the return type of func If(cond bool, children ...ComponentOrHTML) MarkupOrChild
to List
?
This is my use case:
type CustomComponent struct {
vecty.Core
Content vecty.List `vecty:"prop"`
}
func NewCustomComponent(content ...vecty.ComponentOrHTML) *CustomComponent {
return &CustomComponent {Content: content}
}
func (ch *CustomComponent) Render() vecty.ComponentOrHTML {
return elem.Div(
ch.Content
)
}
---
type View struct {
vecty.Core
Flag bool
}
func (ch *View) Render() vecty.ComponentOrHTML {
return NewCustomComponent(
vecty.If(ch.Flag, elem.Div()) // will not compile
)
}
Metadata
Metadata
Assignees
Labels
No labels