Support the ongoing development of Laravel.io →
Laravel Blade
Last updated 2 years ago.
0

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> @enderror

component 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"/>

Last updated 3 years ago.
0

It's weird but finally i found out when i remove component class and just keep component.blade.php everything work fine

0

I have problem on mac os yet in linux everything work fine but on mac i get an error

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.