scottycam's avatar

Livewire Dynamic Component

Hi, I am trying to get Livewire v3 Dynamic children components to work but I am encountering an error.

Docs for Livewire Dynamic Component: https://livewire.laravel.com/docs/nesting#dynamic-child-components

If I use this in my blade view, it renders as expected

<livewire:test />

If I use either of these i get an error ($test = 'test';)

<livewire:dynamic-component :is="$test" />
<livewire:dynamic-component :is="'test'" />

This is the error I get

Livewire\Exceptions\ComponentAttributeMissingOnDynamicComponentException Dynamic component tag is missing component attribute.

I can't make the test any simpler and I am unsure why I am getting the error.

0 likes
1 reply
scottycam's avatar

I figured this out shortly after posting.

The docs are wrong.

The docs say to use :is=

<livewire:dynamic-component :is="$test" />

but you need to use :component=''

<livewire:dynamic-component :component="$test" />
1 like

Please or to participate in this conversation.