I DON'T like Laravel Livewire Volt

Hello, here I wanted to comment or give my opinion quickly again in my opinion why I do not like Laravel Livewire Volt which is this technology that we have is not mandatory yet at least it is to say it places it there as when you go to create a project in Livewirete indicates if you want to use it or not and from there it uses it not well installed no and that is little So basically what is this in case you do not get into context this allows us in a few words to create in a single file in a single file Blade create both or place both the logic and what is the Blade, that is to say the visual part is as if it were a component in Vue:

use function Livewire\Volt\{state};
 
state(['count' => 0]);
 
$increment = fn () => $this->count++;
 
?>
 
<div>
    <h1>{{ $count }}</h1>
    <button wire:click="increment">+</button>
</div>

I give you my opinions:

  • It makes reading difficult because it has denser files and two structures: the blade and the control layer.
  • It makes maintenance difficult, since you can now have traditional components in Livewire or with Volt—basically the same problem as with anonymous components in Laravel and with classes.

The problem that I see with that is that in the end, as they say, now you are going to create a fork in your project in which, as they say, the same element that I understood to be a component of the iware could be in your project, as they say, consisting of two files, its component or its class in a separate file and the Blade and others for no apparent reason, which in this case is the size of it, which would also be something completely personal. Since based on what rule would you define if a file is large or small, I suppose by the number of lines. But if you ask him where it is overwhelming how many lines for you are many or how many lines for you are few or are you also going to put there, it may be that the logic part as we have here is small. But it may be that here it is much longer, it may be that instead of simply 10 lines it is 50. So then from that you would also define it or take it into account to indicate it as dividing it into two or one or rather dividing it into two or placing it in one single file then it's a little bit like that if you went there and I don't like that very much anymore I prefer that all the components in this case follow the same pattern but again that's a matter of taste but it's a little bit what I was telling you and it also introduces a little bit of another thing that is particularly to me that sometimes I didn't like very much which is the use of anonymous components the base that basically an anonymous component is a Blade file I remember that a Laravel component is simply the same as we have here but without vitamins in the base area it would simply be a class that returns a view that is to say instead of following the classic approach of controller and what was its view we can also do it with the components and there you can see the advantage and so on right now it is not the case but there was also the Arabic which was an anonymous component that we can use precisely for elements like buttons since they did not require additional logic therefore it only created its view it was like an orphan view as well or rather there are many references but it was like it says sometimes the problem that I had that sometimes I saw a Larabel component and I didn't know if behind it, that is to say a component view, I didn't know if behind it it also had what was its component class created or if it was directly anonymous. Here I feel a bit like the same, so it is that, basically it is not something that is killing technology here or saying that it is the worst, but I simply wanted to give you a little bit of my opinion here.

I agree to receive announcements of interest about this Blog.

I DON'T like Laravel Livewire VoltI give my reasons why I don't consider Laravel Livewire Volt to be a good tool for developing components.

- Andrés Cruz

En español