Learn Hotwire by building the simplest possible Hotwire and Ruby on Rails app — a beginners guide.
BRANK

You probably dont need a React or Vue frontend. With a few (3) lines of code, you can build a live frontend for your Ruby on Rails app. This is what we will build today ↓ Ruby on Rails and Hotwire app responding live to backend changes — powered by Hotwire and Turbo streams.Hotwire is a (relatively) new part of Ruby on Rails that allows your Rails frontend to update live and in realtime — in many cases, totally replacing a frontend framework like React or Vue.Hotwire is built on Action Cable, another part of Rails for handling real-time communication. Hotwire uses Action Cable to send messages to the frontend (called broadcasts). There are lots of ways to send broadcasts — tooday, we're going to focus on automatically sending them when our Post model gets created, updated, deleted.At MONN, we use Hotwire to power our frontend, and it's been great. With a couple of brodcasts_to lines in our models, and a few turbo_stream_from helpers in our viewss, we can build live UIs without an…

monn.app
Related Topics: Ruby on Rails
1 comments