htmx
htmx copied to clipboard
Update alpine template example in docs.md
Using $watch with AlpineJS in this manner ends up creating a race condition (which I've observed in live code) where sometimes the templated elements are not yet rendered by the time the $watch callback is invoked.
Using x-init like this instead has proven to be 100% reliable and less verbose in my use case - this technique should be recommended to newcomers to avoid the race condition I personally lost time to.