I tried with laravel fresh and i got same error
Laravel:8.22
php:8.0.1
php artisan make:component Error
component blade code :
@props(['for'])
@error($for)
<p {{ $attributes->merge(['class' => 'text-sm text-red-600']) }}>{{ $message }}</p> @enderrorcomponent blade class:
`namespace App\View\Components\input; use Illuminate\View\Component; class Error extends Component {
public function __construct()
{
}
public function render()
{
return view('components.error');
}
}`
usage : <x-error for="title" class="mt-0.5"/>
It's weird but finally i found out when i remove component class and just keep component.blade.php everything work fine
I have problem on mac os yet in linux everything work fine but on mac i get an error
It's weird but finally i found out when i remove component class and just keep component.blade.php everything work fine
@props
works only with anonymous components, if you have a class for your component it will override your @props
, that's why.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community