-
We have been using ViewComponents for a while now and really love them for things like design system components. We are using Tailwind, so it helps keep all of the design elements tight when we need to put a common design element on a page. Some examples of components that fit in this category are things like Tabs, Accordions, Alert Boxes, Pagination, Description Lists, and Tables. However, one of the things I'm struggling with trying to decide is if we should switch all of our partials to use ViewComponents. For example, we might have a specific table with data (which uses a We are already leaving some partials in our app for things like a Where should we draw the line between using ViewComponents vs using partials? My gut is kind of telling me to just have the generic design system elements as ViewComponents and keep repeated content as partials, but I'm curious what other people are doing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Personally, I see no reason not to favor components over partials 100% of the time, and here's why:
In theory, it's possible to use components in place of partials everywhere. In order to do so, you'd need to:
Something that might help you do this consistently is to ensure you have snapshot test coverage across partials, then repurpose those tests for components. |
Beta Was this translation helpful? Give feedback.
Personally, I see no reason not to favor components over partials 100% of the time, and here's why:
helpers
proxy or needing to be included on the classIn theory, it's possible to use components in place of partials everywhere. In order to do so, you'd need to: