1
What is the advantage of using the slot directive in Vue.JS?
I can create items with different information though, but if I pass an array with several different objects and pick them to print on the screen it’s no different... Of course, in my line of sight I’m an amateur...
It may sound silly, but the slot really has some benefit, which are?
According to the documentation:
Vue implements a content distribution API that is modeled after the current detailing of the specification of the Web components, using the element to serve as content distribution output.
I mean, content distribution output the directive v-for
no longer does so?
Take a look here, which is well taught: https://www.youtube.com/watch?v=UiqXVmHg7o&list=PLcoYAcR89n-q1vGRbaUiV6Q9puy0qigW&index=17&t=0s
– LeAndrade
@Leandrade I came from there, so I’m here rsrs. I don’t want to be arrogant, but he didn’t explain the difference and only how he uses... I am not the first to ask, the video you sent me has some comments with some doubts also that have not been answered.
– user152996
From what I read in blog post that the creator of Vue posted the new directive is already a preparation of how it will be in Vue 3 and has performance benefits... The RFC contains more information.
– fernandosavio
I’m not going to formulate an answer because I don’t really understand the new operation, I hope the material helps you.
– fernandosavio