Is it possible to pass a component as props and use it in a child Component in Vue?

Summing up:

<!-- Component A -->
  <div class="A">
      <component :is="child_component"></component>

import B from './B.vue';
import Equipment from './Equipment.vue';

export default {
  name: 'A',
  components: { B, Equipment },
  data() {
    return { child_component: 'equipment' };

<!-- Component B -->
  <div class="B">
    <h1>Some content</h1>
    <slot></slot> <!-- Component C will appear here -->

Leave a Comment