Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Livewire

Smart wire:key Behavior in Livewire v4

Automatic wire:key handling for nested components.

1 February 20261 min readLivewireاقرأ بالعربية

On this page

  1. Configuration
  2. Important Note
  3. What Smart Keys Do

Livewire v4 enables smart_wire_keys by default to prevent issues with deeply nested components.

Configuration

php
// config/livewire.php
// Now defaults to true (was false in v3)
'smart_wire_keys' => true,

Important Note

blade
You still need wire:key in loops!

@foreach($items as $item)
    <livewire:item 
        :item="$item" 
        wire:key="item-{{ $item->id }}" 
    />
@endforeach

What Smart Keys Do

- Prevents DOM diffing issues
- Handles nested component updates
- Reduces unexpected behavior
All articles

Keep reading

  • Authorization in Livewire v4 Components1 February 20261 min read
  • Blaze Pre-Compiler: Massive Performance Gains in Livewire v41 February 20261 min read
  • Building a Bookmark Feature with Livewire v41 February 20261 min read