Courses

Livewire VS Vue VS React: Simple Project

Conclusion and My Opinion

So, after we have tried to create the same page with three different tools, which one is a winner?

I will judge based on two criteria:

  • Ease of use: how quickly could we get up and running, and how much extra knowledge is needed?
  • Future perspective: how easy will it be to customize or add new features in the future?

Which is Easiest to Use?

Judging from the amount of code I had to write/explain for this specific small project, a clear winner is Livewire.

  • It doesn't require any JavaScript knowledge
  • No npm run ... steps to compile
  • It's like writing the same Laravel code, with Blade, just Components instead of Controllers
  • Livewire is full of "quick goodies", like #[Url] that solve some common issues

In other words, Livewire "feels like home" for back-end Laravel developers.

With Vue/React, there's a learning curve of JavaScript and one of those frameworks on top.

Also, you need to know how to set up Vue/React in a Laravel project. Luckily, Laravel Breeze and Inertia helped us with this quite a lot, lowering the amount of code we needed to write manually. Otherwise, the Developer Experience difference from Livewire would be even bigger.

That said, your opinion may be different if you already come from a Vue/React background and have a lot of experience with it. Then, that JS world may feel more "like home" to you. In that case, you only need to adapt to how Inertia works to glue Laravel and JS together as a SPA.


Which Will be Easier to Customize/Maintain?

Now, this is where it gets more tricky. For this simple project, Livewire is an excellent tool for starting off. But let's look at it from a broader perspective.

Projects start small, but they often later grow into more complex pages with more dynamic elements that need to be customized, and JavaScript offers more browser-native features.

Also, Livewire works by sending data to the server each time you need to reload something dynamically. It may become a performance issue with many dynamic elements and users browsing simultaneously. That could be another reason to choose JS, as it all then happens directly in the browser, on the client-side. Livewire also has a solution to this - offloading some functionality to Alpine.js, but it's not that popular worldwide, so it is harder to find help or the exact solutions on forums or elsewhere.

Next, what if the project needs a mobile app in the future? Livewire doesn't have any of that. But, for example, with React, you could transform the code to React Native and change Inertia to Laravel API, relatively quickly.

Finally, Livewire as a technology works only within the Laravel ecosystem. Vue/React knowledge can be ported elsewhere to other projects. So, learning JS frameworks may be more beneficial from a future career perspective.


Wait, But... Vue or React?

If you don't want to choose Livewire and consider one of the JS frameworks, it's mostly a personal preference. Both are good.

Vue is a bit easier to start with in Laravel projects since much work has been done over the years to make them work seamlessly together.

Historically, Vue became popular partially because of its involvement in the Laravel ecosystem, with the creator Evan You even speaking at Laracon. However, according to the State of Laravel results, Vue has been in a slow decline in terms of market share in recent years.

React creators don't participate much in the Laravel community or integration tools, but generally, React is more widely adopted as a technology outside of the Laravel world, which may lead to more career opportunities.


What Do They Use at Laravel Organization?

At the time of writing, the latest official Laravel tools like Laravel Cloud and Nightwatch are built with the RILT stack: React + Inertia. Here's Taylor's comment about the reason for that choice.

That said, historically, the Laravel team has released the tools with other stacks:

So, at the end of the day, it's still mostly a personal choice or your team's choice within your plans for the future.

In short:

  • Wanna quickly launch something with no JS? Livewire.
  • Wanna quickly-ish launch something with JS? Vue.
  • Wanna take time and build for the long term and have opportunities outside the Laravel world? React.

What do you think? Would you make the same conclusions? Let me know in the comments.


Recap: Repository Link Again

You can find the code in our repository. Just switch branches for different systems:

  • main - Our base application without any UI on it.
  • livewire - Livewire Demo
  • vue - Vue.js (Inertia) Demo
  • react - React (Inertia) Demo

We recommend you play around with the code and see which is best for you.

avatar

Hi Povilas, the link to the repo returns a 404 :-/ Did the link change maybe?

BR from Austria, David

avatar

Sorry David, I forgot to make it PUBLIC. Fixed now! Thanks for the notice.

avatar
You can use Markdown
avatar

Good evening, I started with Laraavel a few month ago to create a project with a private wine cellar (with a lot of ideas). I just read this article and made a short lifewire tutorial. Easy to use ! But I even love the ressource controllers from Laravel. So i wonder If it is possible to mix up different frameworks in one project (and is it "state of the art"). Maybe lifewire for the simple things and react for more use in complicated database actions and even use the ressource controllers. And is it possible to combine things like call a ressource controller from lifewire. But anyway , your website an courses are great and I feel lucky to take part of it !

Best regards, Stephan

avatar

Hey,

You can mix different ideas in a project, but probably not in the way you think. Here's why:

  • You can definitely use Resource Controllers with Livewire - just make sure that your Livewire is a component inside the blade view.
  • You can't call Resource Controller methods from Livewire page (remember, Page and Component work completely differently).
  • You can mix React with Livewire, but if I'm being honest - usually that causes a lot of friction. So it's better to use one of them.

In a way, different tech stacks require different setup/workflows. And some basic things, like passing data, can become complicated if they are mixed together. You can of course, use components/properties to pass some data, but they have to be completely isolated. This means - Livewire has to know nothing about React and React has to know nothing about Livewire.

Hope that helps a little bit :)

ps. Mixing of various tools is okay if you really have to, but in general - that can lead to some serious issues down the road. As with everything - you have to know what you are doing to be confident ;)

avatar

Ok thanks a lot :-) Maybe i split the application in an administration part and a user part. But i'm still trying to learn a lot.

avatar
You can use Markdown
avatar
You can use Markdown