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

->form([
    Select::make('rating_id')
    ->prefix('Your choise')
    ->hiddenLabel()
    ->options($this->array_opts)
    ->required()
    ->reactive()
    ->afterStateUpdated(function (?string $state, ?string $old) {
        $this->dispatch('my_event', rating_id: $state);
    }),
    Livewire::make(MyComponent::class, ['article_uuid' => $this->article_uuid, 'rating_id' => $this-  >rating_id]),
])

to update the data of the MyComponent component I thought of using in the select afterStateUpdated $this->dispatch and in my livewire component
#[On('my_event')]
public function doSomething(string $rating_id): array
{
    dd('ok');
    //do something
}

but it seems that the event is not listened, what am I doing wrong?
thanks in advance
Was this page helpful?