DEV Community

Discussion on: How to use SweetAlert2 with Livewire

Collapse
 
vitoo profile image
Victorien Plancke • Edited

Yes, you can also emit the event from the component :

$this->emit('message', 'Your profile has been updated.');

And listen to it in JS :

    Livewire.on('message', message => {
        alert(message); //put sweet alert here :)
    })
Enter fullscreen mode Exit fullscreen mode
Collapse
 
snehalkadwe profile image
Snehal Rajeev Moon

Yes we can do that. Thank you 🙂🙂

Collapse
 
diogolf profile image
diogolf • Edited

Hi, can you give me a real example with a simple success alert or toast message ?
Thank you

Thread Thread
 
snehalkadwe profile image
Snehal Rajeev Moon

Sure, I will make one.