Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Livewire Not Rerendering

I do not know what I am missing but I followed every step but it does not rerender the view.

Here's my livewire component class:

use Livewire\Component;

class HelloWorld extends Component
{
    public $message = 'Hello, world!';

    public function render()
    {
        return view('livewire.hello-world');
    }
}

Here's the livewire view:

<input type="text" wire:model="message">{{ $message }}

When I type in the input box, I see XHR requests being sent but the view does not update. What am I missing here? I have been looking around for answers for few hours already.

like image 604
Patrick Avatar asked Dec 07 '22 10:12

Patrick


1 Answers

From Livewire's docs:

Make sure your Blade view only has ONE root element. Source

Putting it in a div should fix this issue.

like image 195
DanielHM Avatar answered Dec 22 '22 10:12

DanielHM