taha118's avatar

livewire dispatchBrowserEvent function does not exist

I am tring to show alert message of javascript through livewire component public function render() { $this->dispatchBrowserEvent('alert', ['type' => 'success', 'message' => 'User Created Successfully!']); } I gives error Method App\Livewire\Alert::dispatchBrowserEvent does not exist. In resources\views\components\layouts\app.blade.php @livewireScripts doucment.addEventListener('alert', function() { alert('this is alert from component '); });

0 likes
5 replies
thinkverse's avatar
Level 15

Livewire v3 removed emit and dispatchBrowserEvent in favor of using a single dispatch method. Check the upgrade guide.

3 likes
SumitKumar0210's avatar

i try to open my a modal with $this->dispatchBrowserEvent('openModal'); but this error Method App\Livewire\TestUser::dispatchBrowserEvent does not exist. is coming

Please or to participate in this conversation.