يقدم Livewire v4 نهجًا يعتمد على العرض أولاً حيث يتعايش منطق PHP وترميز Blade في ملف واحد.
موقع الملف
resources/views/components/counter.wire.phpالبنية الأساسية
@php
new class extends Livewire\Component {
public $count = 0;
public function increment() {
$this->count++;
}
}
@endphp
<div>
العدد: {{ $count }}
<button wire:click="increment">+</button>
</div>