Live data from Hacker News

Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

alpine-ajax.js.org

11–20 of 26 posts

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#12

A few features which look minor but the author got totally right, which IMHO would allow this solution to scale very well with more complex applications. 1) X-Alpine-Target ``` generates an ajax request with this header by default: ``` X-Alpine-Target: comments comments_count ``` This is very very cool! In most usecases, one the serverside I can return a full html document and alpine-ajax will only look for #comments…

Thank you! I really have tried to sweat those details, it's reassuring to hear that's coming through.

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#14

I use Livewire v3 (also fully Alpine based now) in my latest project and it has truly transformed my approach to web apps. It’s truly amazing.

+1. I’m also using it and it’s truly refreshing after so many unnecessary SPAs. The latest generation of js meta frameworks made me switch and I’m so much happier with Livewire.

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#17
post #16

That looks interesting. It resembles Unpoly approach to me. Quick question about redirect with `nofollow`. Does it do a full page reload or just refresh a page like Turbo (swaps body and merges head)?

It does a full page reload at the moment. I'm about to start work on a full SPA mode that will function more like Turbo though.

Re: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby

#20
post #19

Can it do something similar to hx-trigger="load"?

Yeah, Alpine components have `x-init` that works just like the load trigger. You can fire off an AJAX request inside that directive, there's an example here: https://alpine-ajax.js.org/examples/lazy-load/
Post reply on HN