This is the Livewire framework for Laravel
HTML:
<button wire:click="$emit('postAdded')">
PHP:
protected $listeners = ['postAdded' => 'showPostAddedMessage'];
public function showPostAddedMessage()
{
// Do stuff
}
public function render()
{
return view('livewire.index');
}
Clicking the button calls showPostAddedMessage() and after that render(). How can I listen for an event without calling render()?
I had the same issue. In my case, the render() method was closing my parent modal box. I just added "wire:ignore" in modal div. Livewire ignores that div whenever it calls the render() method