How to use ViewComponent Class

I've write some livewire class using php artisan make:livewire HeroSection than, i include it to other livewire components like this
<div>
@vite('resources/css/filament/rupadana/theme.css')

@include('livewire.components.header')
<main class="space-y-40 mb-40">
@livewire(App\Livewire\HeroSection::class)

</main>

@include('livewire.components.footer')
</div>
<div>
@vite('resources/css/filament/rupadana/theme.css')

@include('livewire.components.header')
<main class="space-y-40 mb-40">
@livewire(App\Livewire\HeroSection::class)

</main>

@include('livewire.components.footer')
</div>
its work, and im start to extends ViewComponent Class
<?php

namespace App\Livewire;

use Filament\Support\Components\ViewComponent;

class HeroSection extends ViewComponent
{

protected string $view = "livewire.components.hero-section";
}
<?php

namespace App\Livewire;

use Filament\Support\Components\ViewComponent;

class HeroSection extends ViewComponent
{

protected string $view = "livewire.components.hero-section";
}
and now the problem begin, its throw an error Unable to find component: [App\Livewire\HeroSection] why is this happening?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server