Introduction to Hotwire/Turbo

Turbo is the evolution of turbolinks Rails library, done to make your web app navigation faster. Giving the performance of a single-page application (like Reac) but with much less complexity and much cheaper development costs in money and time.

We can decompose Turbo in several parts:

  • Turbo Drive: avoids full-reloading of HTML page, just replacing the <body>, giving a clean sense of navigation. It intercepts usual HTTP requests and use fetch for server calls. It also manages full browser history with advance/replace/restore actions.
  • Tubo Frames: It decompose your page in parts using <turbo-frame> tag, which can be replaced by copies received by the server, just locating and replacing them thanks to identifiers.
  • Turbo Streams: Also decompose your page in <turbo-stream> parts with will be fetched to Websocket channels, so they will be replaced on change with no user action needed. Thanks to the broadcasting of Websockets, through ActiveCable channels connected to your clients’ browsers.
  • Turbo Native: Brings these capabilities to the Android/IOS development world, just developing your native mobile application from your web server, avoiding long and onerous upgrade processes in marketplaces. Note that you will use native APIs, you are reusing the view and HTML fragments parts.
  • Turbo Rails: Is the gem which simplifies views programming in Rails backends, including helpers like turbo_frame_tag or turbo_stream_from.

Enjoy the invent!

Leave a Reply

Your email address will not be published. Required fields are marked *