December 20, 2020
Sometimes you want to refresh one Livewire component in response to changes in a separate Livewire component.
For example, some data you've edited and saved in the first component needs to be shown in the second component.
For this, you can use Livewire's events system. First, define the listeners on the Livewire component you want to refresh remotely, so that sending an event called refreshComponent
will call Livewire's magic $refresh
method.
protected $listeners = ['refreshComponent' => '$refresh'];
Now, in the other component, we just have to send an event called refreshComponent
to this component.
$this->emitTo('component-to-refresh', 'refreshComponent')
This event will be sent to the component called component-to-refresh
, and component-to-refresh
will reload its contents.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!