Level 63
public function updatedCount($value)
{
// save the value in the session
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
<?php
use function Livewire\Volt\{state, updated};
state(['count' => session('count', 0)]);
updated(['count' => fn () => session()->put('count', $this->count)]);
$addOne = fn () => $this->count++;
$minusOne = fn () => $this->count--;
$resetCounter = fn () => $this->count = 0;
?>
<div>
<h1>{{ $count }}</h1>
<button wire:click="addOne">+1</button>
<button wire:click="minusOne">-1</button>
<button wire:click="resetCounter">Reset</button>
</div>
I want to use updated function to watch count for store count value in session, but this function not working for me. Anyone have idea about this? Or I doing wrong way?
Please or to participate in this conversation.