livewire component with event in form
hello everyone,
I have inserted inside my form, a select and a livewire component that simply has to display a blade with data (html and css), which should update when the state of the select changes
to update the data of the MyComponent component I thought of using in the select afterStateUpdated $this->dispatch and in my livewire component
but it seems that the event is not listened, what am I doing wrong?
thanks in advance
2 Replies
on which class you are firing event and on which listening for it?
it seems solved, the cause seems that inside my livewire component MyComponent::class I had not imported the class use Livewire\Attributes\On;
used in the function
#[On('my_event')]
public function doSomething(string $rating_id): array
{
dd('ok');
//do something
}