Search code examples
phplaravellaravel-livewire

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.


Solution

  • From Livewire's docs:

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

    Putting it in a div should fix this issue.