Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #372
    dan
    Participant

    Basically there are three ways to generate components in Laravel Blade:

    (1) Standard

    php artisan make:component Alert

    You generate both the class component and the view component

    (2) View Only

    You create a blade file under Components folder with a name alert.blade.php

    (3) Component only

    php artisan make:component Alert –inline

    The first and second type are the most common but how do you actually use the third one? How do you call it in your view template?

    #374

    Even though inline components have only class components you can call them in the same way if they have a view component. For example

    When you issue this command:

    php artisan make:component Alert –-inline

    It will generate a class without a view component. Even though thats the case you can still call it anywhere in your application
    as

    <x-alert />

    and it will render whatever in the return html elements you put in the render() method.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.