4

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.

Vinícius Fagundes
  • 1,983
  • 14
  • 24
Patrick
  • 341
  • 1
  • 7
  • 19
  • Does this answer your question? [Laravel Livewire component not refreshing/reloading automatically after refreshing it](https://stackoverflow.com/questions/60395647/laravel-livewire-component-not-refreshing-reloading-automatically-after-refreshi) – Qirel Oct 13 '20 at 21:00

2 Answers2

19

From Livewire's docs:

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

Putting it in a div should fix this issue.

DanielHM
  • 206
  • 2
  • 2
0

Your blade view must have only one root element and it should looks like below :

<div>
    <input type="text" wire:model="message">{{ $message }}
</div>
Josef
  • 2,869
  • 2
  • 22
  • 23