Create new component have an error
hello seek help, i've component with livewire, this is the code:
<?php
namespace App\Livewire;
use Livewire\Component;
class RefreshWarning extends Component
{
public $data;
public function __construct(
protected string $name,
) {}
public static function make(string $name): self
{
return new self($name);
}
public function mount($data = null)
{
$this->data = $data;
}
public static function canView(): bool
{
return true;
}
public function render()
{
return view('livewire.refresh-warning');
}
}
when i call that component like this:
RefreshWarning::make($this->isActive)
have error:
Filament\Forms\ComponentContainer::Filament\Forms\Concerns{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, App\Livewire\RefreshWarning given
please help me:( i'm stuck on 3days1 Reply
You cant add a livewire component directly into a form use:
https://filamentphp.com/docs/3.x/forms/advanced#inserting-livewire-components-into-a-form