How can I emit to a specific component when I have multiple copies of it in the same page?
I have seen in the doc
Livewire.emitTo(componentName, eventName, ...params)
Emit an event to specific component name
but I don’t know how to use in my case.
I have in my main component 50 pairs of radio buttons. The radio buttons are used for the selections of articles I have in my database. The 2 possible radio values are ‘Random’ or ‘Custom’.
If ‘Custom’ is selected, an article selector component is displayed and the selection of the article can then be done, If Random is selected, there is nothing to do
When an article is selected it is via the article selector, it is passed to the main component using emitUp(). That works fine.
My issue arises when I submit the form. I have the validation done in the main component and need to pass its result to the relevant article selector as some may have errors
right now my article selector component is called with
@livewire('admin.homepage-article-selector', ['label' => 'Select article', 'articleUuid' => NULL, 'name' => 'year1_slot1_article', 'key' => "year1_slot1_article"])
but there is nothing differentiating it from the next article selector wich is
@livewire('admin.homepage-article-selector', ['label' => 'Select article', 'articleUuid' => NULL, 'name' => 'year1_slot2_article', 'key' => "year1_slot2_article"])
So, Is there a way to target a specific single component?
and I suppose Is there a way to target exclusively multiple component?