Reactive html apps in Go & alpine.js

Later we use fir’s alpinejs plugin to reinforce the shape
submission and obtain the re-rendered template as an
occasion. The occasion is dealt with by the
$fir.exchange()
helper perform which
updates the interior content material of the div on which the occasion
listener is asserted. Click on the buttons beneath to see
reactivity in motion.
As you may discover, the rely worth is up to date with out a
web page reload. The server aspect code stays unchanged.
@fir:event-name:event-state::template-name
piggybacks on
alpinejs event binding syntax
to declare
html/templates
to be re-rendered on the server.

If the handler response for occasion
inc
is okay
then
re-render the template named
rely
on the server and return the
html output to the occasion listener as a
CustomEvent. The
CustomEvent.detail
property is utilized by the alpinejs plugin helper
$fir.exchange()
to replace the div
on which the listener is asserted.
go run counter.go
Open your browser and go to
http://localhost:9867
to see the reactive counter in motion.