What do you think of the API? #58
Replies: 4 comments 13 replies
-
Hi @markuswustenberg, liking what you have done with this. I'm just playing around with gomponents now, what would you say is the best way to do conditional rendering? Have I missed something in the API? |
Beta Was this translation helpful? Give feedback.
-
Very, nice, but one question are (or can) the components (be) loaded concurrently or is it planned to do so? |
Beta Was this translation helpful? Give feedback.
-
I know this is an old discussion and the API is likely not open for changes any more but I was wondering if you ever considered or would consider an API like the following: type Node func(w io.Writer) error
type Attribute Node
type Element Node
// example of an attribute
func Class(classes ...string) Attribute {...}
// example of an element
func Div(attr ...Attribute) func(...Element) Element {...} which would make the components look like the following: func NewTaskForm() Element {
return Form(HxPost("/todos"), Class("new-task"))(
Input(Type("text"), Class("task-text"), Name("text"), Required(), Placeholder("Type new task")),
Button(Class("new-task"))(Text("Add task")),
)
} The main difference being that |
Beta Was this translation helpful? Give feedback.
-
I love the API!! Can't think of a single thing I don't like about it. Thank you for the awesome library |
Beta Was this translation helpful? Give feedback.
-
I'm experimenting with the gomponents API, to make it as easy as possible to build view components in Go. What do you like? What don't you like? Let me know below. All feedback is appreciated. 😊
Beta Was this translation helpful? Give feedback.
All reactions