<svg id="heroicon{{ $result->id }}"
onclick="changeIconColor('{{ $result->id }}', event)" >
...
</svg>
changeIconColor is defined asfunction changeIconColor(id, event) {
const heroicon = document.getElementById(heroicon${id});
const currentFill = window.getComputedStyle(heroicon).getPropertyValue('fill');
if (currentFill == 'none')
heroicon.style.fill = 'red';
else
heroicon.style.fill = 'none';
Livewire.dispatch('toggle-state', {
id: id,
isActive: true
})
} public function toggleState($id, $isActive)
{
$this->skipRender();
...
}
$this->skipRender(); would suppress(per https://livewire.laravel.com/docs/actions#skipping-re-renders)