Home > Net >  Laravel Livewire component is not refreshing when the data is updated
Laravel Livewire component is not refreshing when the data is updated

Time:10-31

products cards in the loop and add to basket button Livewire component after data update all HTML is mixed

@forelse ($products as $productItem)
    <div >
        <div >
            .........
            <livewire:add-to-basket-button :product-id="$productItem->id" />
        </div>
    </div>
@empty
    .......
@endforelse
any idea ?

CodePudding user response:

Add key()/wire:key to nested components in a loop

try

@livewire('your-component', ['id' => $id], key($id))

  • Related