Partials vs for loop - best practices

When encoding your viewing templates, you can display a partial one and pass an array of objects that will be rendered once for each object. OR you can use the For space in the @blank loop. How do you decide when to do it? It seems that if you use a partial for each exterminated object, you will have to change tons of individual files to make changes to a potentially one view. With the help of loops you can see everything in one file.

+3
source share
1 answer

Usually I use only partial for a single object when I need to display this single object somewhere else, for example, in the form of RJS. In my opinion, this makes things a little easier.

+2
source

Source: https://habr.com/ru/post/1748929/


All Articles