Emitting events to a single component

For anyone looking to emit events but only want them to be picked up for a specific component even if you have more than one component of that type on the page.


<livewire:product sku="1">
<livewire:product sku="2">
<livewire:product sku="3">

If you call ->emit('productUpdated') it will do 3 HTTP requests but if you only want one component to be updated you can use more specific event names like productUpdated:1 to only update a single component.

I’ve written up a blog post on the solution here:

1 Like