1

I'm trying to refactor my code into readable and short pieces. Therefore sometimes I need to create a dumb component which only is holding the repetitive part of my code. For example I wanted to use Table component from PrimeVue library and I tried to render the Column component in an other component But the problem is when I use it, the component wraps it's content which is Column inside it's own name. Of course not in the real DOM But in Vue Devtools tree. Well it breaks the Table component's connection with the 'Column' which is inside new component.

What I want to achieve is to implement React.Fragment in Vue.

I tried to find a way but I found nothing related to this case.

1
  • 1
    This looks like XY problem. Consider addressing real problem with code you have, the answer will be different. "Of course not in the real DOM But in Vue Devtools tree" - why should this be a problem? This is real component structure. The problem is primevue's Datatable handles Column in a special way, it gets metadata from its props and expects it to be a direct child. It would be exactly the same in React for a table component working this way Commented Jun 19 at 9:43

1 Answer 1

0

You don't need to have a single root node (wrap it into something like a fragment) in Vue. Use a component and put everything at the top level.

https://v3-migration.vuejs.org/new/fragments.html

Not the answer you're looking for? Browse other questions tagged or ask your own question.