Develops reactive Livewire 4 components...
Activate this skill when:
Use search-docs for detailed Livewire 4 patterns and documentation.
{{ $assist->artisanCommand('make:livewire create-post') }}
{{ $assist->artisanCommand('make:livewire create-post --mfc') }}
{{ $assist->artisanCommand('make:livewire create-post --class') }}
{{ $assist->artisanCommand('make:livewire Posts/CreatePost') }}
Use php artisan livewire:convert create-post to convert between single-file, multi-file, and class-based formats.
| Format | Flag | Structure |
|---|---|---|
| Single-file (SFC) | default | PHP + Blade in one file |
| Multi-file (MFC) | --mfc |
Separate PHP class, Blade, JS, tests |
| Class-based | --class |
Traditional v3 style class |
| View-based | ⚡ prefix | Blade-only with functional state |
These things changed in Livewire 4, but may not have been updated in this application. Verify this application's setup to ensure you follow existing conventions.
Route::livewire() for full-page components; config keys renamed: layout → component_layout, lazy_placeholder → component_placeholder.wire:model now ignores child events by default (use wire:model.deep for old behavior); wire:scroll renamed to wire:navigate:scroll.wire:transition now uses View Transitions API (modifiers removed).$wire.$js('name', fn) → $wire.$js.name = fn; commit/request hooks → interceptMessage()/interceptRequest().@island) for isolated updates; async actions (wire:click.async, #[Async]) for parallel execution.defer, lazy.bundle for optimized component loading.| Feature | Usage | Purpose |
|---|---|---|
| Islands | @island(name: 'stats') |
Isolated update regions |
| Async | wire:click.async or #[Async] |
Non-blocking actions |
| Deferred | defer attribute |
Load after page render |
| Bundled | lazy.bundle |
Load multiple together |
wire:sort, wire:intersect, wire:ref, .renderless, .preserve-scroll are available for use.data-loading attribute automatically added to elements triggering network requests.| Directive | Purpose |
|---|---|
wire:sort |
Drag-and-drop sorting |
wire:intersect |
Viewport intersection detection |
wire:ref |
Element references for JS |
.renderless |
Component without rendering |
.preserve-scroll |
Preserve scroll position |
wire:key in loopswire:loading for loading stateswire:model.live for instant updates (default is debounced)smart_wire_keys defaults to true; new configs: component_locations, component_namespaces, make_command, csp_safe.wire:transition uses browser View Transitions API; $errors and $intercept magic properties available.wire:poll and parallel wire:model.live updates improve performance.For interceptors and hooks, see reference/javascript-hooks.md.
Livewire::test(Counter::class) ->assertSet('count', 0) ->call('increment') ->assertSet('count', 1);
wire:key on all @foreach loopswire:key in loops → unexpected re-renderingwire:model real-time → use wire:model.live