-
Hey everyone, So right now I am putting all my HTML code which I want to reuse like Button, Text, Tag, Card etc. in a separate view component. I got comments like:
Link to the original thread: https://www.reddit.com/r/rails/comments/1dmtzg6/comment/la0tr1w/?context=3 So right now I am confused, is extracting something like a button which I would theoretically reuse on every Page in a View Component actually an anti-pattern? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @JangoCG! According to our docs, ViewComponent provides speed benefits over using partials for this purpose. Using ViewComponent to build a library of components in the way you're suggesting is also done in some large-scale production environments, with potentially more in this list (including @fac). Let me know if you've got any further questions! |
Beta Was this translation helpful? Give feedback.
Hi @JangoCG! According to our docs, ViewComponent provides speed benefits over using partials for this purpose. Using ViewComponent to build a library of components in the way you're suggesting is also done in some large-scale production environments, with potentially more in this list (including @fac). Let me know if you've got any further questions!