- Welcome back to another
episode of Ask Matt. Today's question's from
Gustavo Jordan, who says, "Hi Matt, after I learned
Laravel from your book, "do you advise to learn
Livewire or plain Vue?" So what he's saying here is
that the majority of people who are working in Laravel are working in some other front end stack. And a lot of older projects
are using jQuery and Angular and stuff like that, but the majority of
products today use Vue. Second after that would probably be React. Ember's pretty far down the list. And then there's new projects, Livewire and Inertia and Alpine, that are getting some play. So I did some YouTube videos
that you can check out about converting
novapackages.com, the homepage, from using Vue to using Livewire. And if you're not familiar with Livewire, there's a great video introducing it, but also from the Laracon Online videos. So go laracon.net for that. And Caleb Porzio, the founder of it, talked all about it and
gave a really great intro at Laracon Online. But you can also go to
laravel-livewire.com to check it out and learn more about it. And the way it works is
it's sort of like PJAX or, I don't know why I can
never remember the name of the Rails project that does that, but where you got two
server rendered requests and let's say you're
on the list items page, and you tap into an item
and instead of actually fully rendering the next page, it sends an AJAX request
over to the next page and the next page knows that
this is through this thing called PJAX, and it only
sends back just the portion the page that changed. So Livewire's very similar to that, except it's much more intelligent, in terms of how you're
defining these components. Whereas, the PJAX and
other systems like that, like the Rails one, which I
can't remember the name of. You'll all tell me in the
comments, I'm confident. They just kind of look at the app boundary or something like that, and so they're kinda dumb in terms of the updates they're making. So Livewire's a lot more intelligent, in terms of the changes it's making and the things that it's tracking. And so with Livewire, you
define individual components and they have their own
state, sort of like in Vue. So, I could go way more into it. I'll probably do some introductory videos that are more intentional,
not just live streams. But in general, this
question he's asking here is if I just finished learning
Laravel, what do I learn? Do I learn Vue? Do I learn Livewire? So my canonical response in
the past has always been, "Definitely learn Vue." There's a ton of people hiring for it. A lotta people are using it. It's really powerful and it's really well and healthily integrated
into the Laravel world. However, I think that there's gonna be a little bit of differentiation
now, as I think about that. Now, Inertia is something
that plays really nicely on top of Vue and React. So, you still need to learn one
of the front end frameworks. So Inertia's great, but you still need to use something else. Alpine is way too small to
handle all your JavaScript stuff. It's very useful to learn. You should learn it. It's very quick and easy, but it's not a replacement for anything. But I think that the Vue versus Livewire is actually a really
interesting conversation. So I would say for starters,
what are you trying to do? And this is what I said to his tweet. Are you trying to get a job? People are hiring for Vue. If you wanna get a job, go do Vue. Are you trying to learn
a front end framework that's gonna be flexible
across all the other back ends you work with? Go for Vue. Livewire's only for Laravel. However, are you a Laravel programmer who is trying to be able to do
things like the page updates, when you go get new data, or new lists, or change a certain component on the page, but it's not really massive changes. You're not doing single page apps, you just want things
to be more responsive, and things not have to
refresh the whole page when you're changing out
certain pieces of it. Or do you want certain
pieces of it to update with pagination, or with search results, or something like that? If you wanna do just that,
and you're on your own, or you're a small enough team where you can get buy in for Livewire, or if you're watching this
video a little bit later and Livewire has really
picked up a little bit more, I think Livewire's great
because the Livewire syntax is almost exactly the same
as the Laravel syntax. And so for a Laravel
developer to learn Livewire, it's gonna be much simpler than for a Laravel developer to learn Vue. So that doesn't mean
I'm saying all projects should switch from Vue to Livewire. I think there's good projects for one and good projects for the other. But to this specific question, should I learn Livewire or
Vue if I just learned Laravel, I would say if you're in a context where you can use Livewire, which is not everybody
and not every project, and also not every hiring situation. If you're in a project
where you can use Livewire, I think it's gonna be a much faster route from I know Laravel to I can
make responsive front ends, than it would for Vue. And so I think that's a really
interesting place to be in because I've just said Vue for the longest time for everybody. I think this is inspiring me to make a intro to Livewire video of my own, even though Caleb's is really
great on the Laracon one. So, maybe if you see this
more than a couple days after I put this video out, you might see that I've
got a video coming out. And if you haven't subscribed, go subscribe so you can
see when it comes out, 'cause I think I might make
a intro to Livewire video. So, hope this helps. Send me more questions. I'm on Twitter @stauffermatt or you can put them in the comments below. Thanks. (upbeat music)