I'm learning how to use livewire and laravel, I was trying to bind some data through an input I wrote this code:
home.blade.php:
<html>
<head>
<title>Home</title>
@livewireStyles
</head>
<body>
@livewire("hello-world")
@livewireScripts
</body>
</html>
hello-world.blade.php:
<div>
<input wire:model="nome" type="text">
<br>
Hello {{ $nome }}
</div>
HelloWorld.php:
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class HelloWorld extends Component
{
public $nome = 'Name';
public function render()
{
return view('livewire.hello-world');
}
}
It is running on Apache 2.4 But if I open the browser console when I load the page I get:
(index):29 GET http://localhost/livewire/livewire.js?id=c1db26b321e994f87254 net::ERR_ABORTED 404 (Not Found)
(index):35 Uncaught ReferenceError: Livewire is not defined at (index):35
I'm following official docs and screencasts, I tried to follow step-by-step all the instructions but it didin't work either. Maybe I did something wrong during installation, but I don't think so, because I just hit:
composer require livewire/livewire
so it should be ok. Any clues?
GitHub repo: learningLaravel