'Laravel livewire Undefined type 'Livewire\Component'
after i added livewire using
composer require livewire/livewire
and creating new livewire component
using
php artisan make:livewire search
I keep getting an error Undefined type 'Livewire\Component'
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Search extends Component
{
public function render()
{
return view('livewire.search');
}
}
?>
Can you help me please what am i doing wrong here
Solution 1:[1]
As mentioned in the documentation (https://laravel-livewire.com/docs/2.x/quickstart):
Import livewire in your layout with:
...
@livewireStyles
</head>
<body>
...
@livewireScripts
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Max Romagnoli |