beet
beet copied to clipboard
Beet HTMX
The HTMX pattern is very similar to the server islands pattern: a route that returns html, defined with template directives. We have an even greater motivation to reduce running client-side code because wasm bundles are generally larger than js.
Doing this inside beet instead of just using HTMX should make for a cleaner experience, for example server actions are type safe and we know the http method for them so that doent need to be redefined. It may also be slightly more performant because we can do the evaluation at build time instead of on the client.
fn Button() -> impl Bundle{
rsx!{
<button bx:action=actions::weather
bx:trigger="click"
bx:target="#output"
bx:swap=BxSwap::InnerHtml>
Get the weather
</button>
<output id="output"></output>
}
}
example minimal runtime derived from fixi.js by copilot bx.js