Laravel blade template inheritance vs Laravel component

1.9k views Asked by At

I'm wondering if it is worth moving from this code.

@extends('layouts.app')
 
@section('title', 'Page Title')
 
@section('content')
    @foreach ($tasks as $task)
        {{ $task }}
    @endforeach
@endsection

To this one.

<x-layout>
    <x-slot:title>
        Custom Title
    </x-slot>
 
    @foreach ($tasks as $task)
        {{ $task }}
    @endforeach
</x-layout>

I mean is it better to use Laravel components instead of just using @extend, @yeild, and @section etc..

0

There are 0 answers