How to Use Apline JS with Hotwire and Turbo

17-Nov-2021 1126
There's some new spice in Ruby on Rails... Hotwire ⚡️ which replaces Turbolinks with Turbo. ... Tagged with ruby, rails, hotwire, alpine.What's the Difference Between Turbo and Turbolinks?It's a simple transformation, Turbo works with links and forms but Turbolinks only works with links.How Does Turbo Break Alpine JS?In Alpine JS there's the x-show and x-if directives that allow you to show and hide HTML elements and content, this is broken when using Tubo.Thankfully, SimoTod on GitHub has created the JavaScript package alpine-turbo-drive-adapter that solves the problem.You can easily install this with a RailsBytes that I created:.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle