0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[自分用メモ][比較]turbo_frames、turbo streams、普通のjs

0
Posted at

単純なDOM操作を実装することを前提に比較してみます。

turbo frames

  • サーバーサイドでコードが完結
  • 「新しいページの内容を取得して、そこから該当するフレームを抽出する」という仕組み
<適した機能>

編集フォームのモーダルを表示したいとき など

turbo streams

  • サーバーサイドでコードが完結
  • 「このDOM要素にこの操作をしてください」という命令
  • 単なる差し替え以外のアクションもある
<適した機能>
  • ブックマーク
  • コメント
    など

普通のjsが「適している」、または「必要」な場合

  • マウスやキーボードの動きに追従する必要がある場合
  • 既にブラウザ上にあるデータを操作するだけで、サーバーとの通信が不要な場合
  • 複雑なアニメーションや視覚効果が必要な場合
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?