Another one-liner to speed up your Livewire apps ⚡️ can you spot the difference?
The first example uses a custom method that updates the property on the backend like this:
$this->selected =
$value
This might seem intuitive, but it clutters your code and makes your app feel slow because the UI only updates after the server responds.
Instead, use the built-in
$set helper.
This magic method updates the state on the frontend first and only then triggers the server request.
This way, all your wire:models react instantly, giving users that immediate feedback and a snappy UI