Laravel & Php

Refreshing / Re-Render a Livewire Component


Refreshing / Re-Render a Livewire Component
<script>
    Livewire.emit('postAdded')
</script>

Refresh / Re-Render from Global Javascript

$this->emit('refreshComponent');

Re Render from Component itself

<button wire:click="$emit('refreshComponent')">

With this, livewire will call the render method whenever refreshComponent event is fired.

You can emit the events using any of the available method.

Refresh Component from Template

protected $listeners = ['refreshComponent' => '$refresh'];

You can add a listener to your component that refreshes itself.

To add a listener to make the component refresh itself, simply add the following line to your ProductIndex component.


Livewire
Share with Friends

Like this chef? Share with friends..