タグ

2020年12月17日のブックマーク (1件)

  • Overview

    Why use ViewComponents? TL;DR ViewComponents work best for templates that are reused or benefit from being tested directly. Partials and templates with significant amounts of embedded Ruby often make good ViewComponents. Single responsibility Rails applications often scatter view-related logic across models, controllers, and helpers, diluting their intended responsibilities. ViewComponents consoli

    sh19e
    sh19e 2020/12/17
    Ruby Objectなのでユニットテストや品質チェックが容易, 宣言的な記述でデータフローを整理して再利用性を向上、pertialsと比較して~10x高速。CSSやJSも管理できるSidecar、動作確認やスタイルガイドに使えそうなPreview機能など