Livewire doesn't update mount variable

Viewed 33

I search a lot of hours by finding a solution on my question. I'm new to Livewire but I think after working on a project of like 2 months I'm stuck in the most simple question i know, and I can't find it in the Livewire docs.

My variable isn't updating after an onclick event.

my component:

public function mount()
{
    $this->schedules = 0;
}

public function addScheduler()
{
    $this->schedules++;
}

My onclick event:

wire:click.prevent="addScheduler()"

My blade:

<div class="col-lg-12">
    <div class="all_schedules">
        {{ $schedules }}
        @for($i = 0; $i < $schedules; $i++)
            @livewire('scheduler.manager.scheduler')
        @endfor
    </div>
</div>

code share: blade = https://codeshare.io/zyeWqO component = https://codeshare.io/bv6loA

0 Answers
Related