$count = 0; public function increment() { $this->count++; } public function decrement() { $this->count--; } public function render() { return view('livewire.counter'); } } 15/26
$count = 0; public function increment() { $this->count++; } public function decrement() { $this->count--; } public function render() { return view('livewire.counter'); } } 15/26
$count = 0; public function increment() { $this->count++; } public function decrement() { $this->count--; } public function render() { return view('livewire.counter'); } } 15/26
$count = 0; public function increment() { $this->count++; } public function decrement() { $this->count--; } public function render() { return view('livewire.counter'); } } 15/26
$count = 0; public function increment() { $this->count++; } public function decrement() { $this->count--; } public function render() { return view('livewire.counter'); } } 15/26
sends an ajax request to PHP 3. PHP calls the corresponding method, which updates $count 4. PHP re-renders the Blade template and sends back the HTML 5. Livewire receives the response, and updates the DOM 19/26
now? Not exactly. [...] it's better to use JavaScript for things that need to be instant (like animations) [...] A good rule of thumb is: any JavaScript components that rely on ajax for server communication, will be better off as Livewire components. — Caleb Porzio 22/26