Oct 11, 2024
0
Level 1
Rendering component in php class breaks parent component in livewire 3
In livewire 2 I used to sometimes mount Component in PHP Class and pass it as variable to blade. Please check following:
public function render()
{
$this->var = Livewire::mount('system.component')->html();
return view('livewire.system.item');
}
Blade:
{{ $var }}
There are some reasons for this. Eg. I pass this var to modal.
Now in Livewire 3 Im trying to do the same, but cant get it working.
First thing is we lost ->html() method. So I`m just trying to run
$this->var = Livewire::mount('system.component');
And the main thing layouts.app blade stops receiving anything in @stack('scripts').
Any ideas how can I mount the Component in PHP Class? I want to pass it as rendered HTML string to blade.
Please or to participate in this conversation.