Hotwire #1 boost your Rails App
Hotwire is an out of box solution. When you use it you will love it. The first day when I use hotwire in my rails app, the Second day I was eager to find Hotwire sticker for my laptop. I am ReactJs Rails developer and I built many applications in the same technology stack. After using Hotwire I can say it will reduce your 80% javascript efforts and it will be a game-changer in 2021-2022.
What is Hotwire?
Hotwire is a new generation SPA(Single Page Application) solution without writing any JS. Yes, this is true, Without using hotwire it's hard to imagine like we can make SPA without writing any JS. Hotwire serves HTML over the wire, not JSON.
Here I am not going in-depth like how Hotwire works but I am here to share how Hotwire is good. I have added a hotwire tutorial link at the bottom of the blog.
How to use Hotwire in rails app?
Do not think too much, It's very quick to integrate hotwire in your rails app. You just need to add hotwire-rails gem and follow the instruction written in the gem doc. When you will run the generator you will see it will remove the Turbolinks. Hotwire turbo is a replacement for turbo.
How Hotwire turbo is different from Turbolinks?
Everybody knows about Turbolinks, So here we will talk about how Hotwire Turbo is different from Turbolinks. Turbolinks good but Hotwire Turbo is super. Turbolink load HTML get for get request and for Post request its reload the complete page and that make UX very bad. Hotwire Turbo is super because it will work for both getting and Post. So In both requests browser will not reload the assets. There are some other good features for Hotwire Turbo like Frames and Stream. You can read those in the official documentation.
Here our goal is to just inspire you for Hotwire and next we will come with some real-life problems and solutions. You can read more about hotwire https://hotwire.dev/. You can read next, Create Infinite scroller with Hotwire Turbo.
Want to hire ruby on rails technical advice, consult our technical experts.