Skip to content
Discussion options

You must be logged in to vote

Personally, I see no reason not to favor components over partials 100% of the time, and here's why:

  • Using components makes it more practical to unit test parts of the view
  • Components help you work towards better encapsulation of your views, thanks to:
    • helpers only being accessible by the helpers proxy or needing to be included on the class
    • them working in their own contexts (instance variables from the controller are inaccessible)
  • The class/view structure of components gives you a structured idea of a view-model layer, which helps you to separate view logic from the controller

In theory, it's possible to use components in place of partials everywhere. In order to do so, you'd need to:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joelhawksley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants