Dynamic Content

Dynamic Content with HTMX

HTMX allows for easy creation of dynamic content:

app.Get("/load-more").Handle(func(c *gofh.Context) gofh.Element {
    return gofh.Ul(
        gofh.Li("New item 1"),
        gofh.Li("New item 2"),
    )
})

Then in your main page:

gofh.Button("Load More").
    HxGet("/load-more").
    HxTarget("#item-list").
    HxSwap("beforeend")

Last updated