Today we are learning about a feature in Livewire that allows me to fetch data before pressing a key and invoking the api see an example
<div>
<button wire:click.prefetch="getPrice">Show</button>
Price: {{ $price }}
</div>
in livewire component
public function getPrice() {
$this->price = Http::get('') ?? null;
}
I hope you take advantage of this feature
Source :- https://www.youtube.com/watch?v=e2MMO_b0Yj0
Top comments (0)