Hotwire
https://hotwired.dev/
Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire.
サーバサイドのアプリケーションのみで、SPA風のフロントエンド体験を開発することができるツール群
JSONを返したりJavaScriptを駆使しなくてもサーバからブラウザにHTMLを返すだけでよい
HTML Over The Wireの略称
37signalsが開発しておりRails 7から標準となったが、Hotwireの各種ツールやライブラリはRailsには依存していない
構成要素
Turboは以下の4つから成る
Turbo Drive
accelerates links and form submissions by negating the need for full page reloads.
ナビゲーション時にDOMを部分的に更新するmorphingが実現されている
従来はフォーム送信後のリダイレクトやページ再読み込みでは<body>の全置換が行われていた
Turbo 8からは内部的にIdiormorphライブラリを用いて差分的にmorphすることで表示中のコンテンツを保ったまま変更箇所だけを更新できるようになった
Turbo Frames
decompose pages into independent contexts, which scope navigation and can be lazily loaded.
Turbo Streams
deliver page changes over WebSocket, SSE or in response to form submissions using just HTML and a set of CRUD-like actions.
Turbo Native
lets your majestic monolith form the center of your native iOS and Android apps, with seamless transitions between web and native sections.
Stimulus
"Turboによって80%ぐらいのJSは書かなくてもよくなる"が、それでも足りない動的なUI/UXのために用いるmodestなフレームワーク
Hotwire Native
mobile appを作るための仕組み
例
HEY
RubyEvents
https://apps.apple.com/us/app/rubyevents/id6743987375
Herbの作者Marco Rothが開発
関連
2022-07
Hotwireかんたん入門