YouTubevideo· Aug 17, 2024· 12:44· 20K views on YouTube

Laravel Livewire vs. React/Svelte/Vue (Inertia)

Watch on YouTube ↗
0:00

React at a moment you like. The best moments light up here.

transcript

30 moments
  1. this is a little bit of a rant video and it might get a little spicy because in my personal opinion if you are building within laravel especially if you're coming from the JavaScript ecosystem you're probably not going to want to use react or view or spelt with inertia within lville you probably are going to want to use Livewire okay that opinion isn't just clickbait seriously it's something that

  2. I truly believe now I love inertia and I think there's going to be amazing things to come out of inertia especially as the Lille team focuses on building out inertia and you're probably going to see a bunch of it at laracon in the next couple of weeks but why would I say that people who are coming from the JavaScript ecosystem so if you're watching this video and you have been following along with the JS the laravel marketing that I've been trying to put

  3. out most of the time if you're frustrated with the JavaScript ecosystem you you're fine with learning a new syntax you're fine with learning PHP but you still have this mindset of I want to build things the way I have been building just with a little bit more niceties a little bit more magic a little bit more things given to me out of the box I have videos Galore on this because it's something that's very

  4. personal very passionate that I'm passionate about and inertia is great but here's why I don't think it works great for people who are used to doing things in the JavaScript ecosystem because it starts with a very MVC mindset mentality now this might change with the things like server components within react and it might change like how you write inertia components talking to a

  5. Lille backend maybe you are writing serers side logic within a react component and you know fetching and querying data that way but currently that's not the case if I was to write a inertia component within react this is showing it within view but it's the same thing with react I have this front end and I'm basically just getting props from my back end we're passing users to

  6. this users. view if I want to do something simple make a button and I then want to have this button Kickstart a q within larvo let's say I have this Q system within larvo where I click this button and I send an email to all of my users within my database okay with within inertia front end within view reacts felt whatever have you on the

  7. front end I would create a button with a form and then I would have to hook that up to a controller in Lille and if you've been writing in modern remix in modern nextjs and modern felt kit that just seems a little weird sometimes because you you're just not used to it again it doesn't mean that this is wrong I think this is fantastic especially with bigger code bases but if you're looking to do something something just

  8. simple quick and easy most of the time that takes you out of the flow of work I have to create a new form with a button to hit a new controller and in that controller I want to Kickstart a queue and then I have to deal with the error messaging and handling and everything like that there's the logic and view are separated this is why I think Live Wire is is perfect for people who are wanting to build things quickly especially if you're maybe like a single solo

  9. developer within the lville ecosystem system because you get all of the niceties within Layel but you write it in a way that feels very single file component react server component type react nextjs type react where you have all of your hooks if you will and you have your server code that you're writing again this is probably the people who have kept up with the bleeding edge stuff so if you're still writing MVC type react yes

  10. inertia perfect for you if your team's still writing MVC type stuff or you like the spelt kit style way where you have separation of concerns between your logic and your view yes inertia is perfect for you because you have that separation me I like again personal opinion I hate that I got to say it but I like having things in one file I like having a button where I can be like oh yeah I need to send off a queue and then

  11. I have some server State just a couple of lines up I just scroll to the top of the file and I have that button to Kickstart the Q I can do all of that without having to create a new controller um a new route within that controller because it's probably going to be like post email send email controller and then I have to write the Q all in that in that controller and

  12. then use the form within inertia to Kickstart all that this is why I think the difference between Live Wire and volt doesn't really come down to or Live Wire and inertia I should say doesn't really come down to okay what kind of application are you building I think the limitations of Live Wire in that sense especially with Live Wire 3 they've deteriorated you're not worrying about

  13. okay if it's a very heavy client side application that I'm going to use react review no I don't think that's the case if I'm using react one of the things that I or if I'm using inertia one of the things that I am passionate about within that is using AP resources because here's another element that I think I like better within Live Wire is

  14. I if I'm querying and say okay I want to display the username to someone just hey when you're logged in here's your username hello there Josh you have to be careful that you're not sending all of the users information to the page within react inertia view inertia spell inertia because it's just an API you're sending that data you're not server rendering that data unless you're using server

  15. rendering inertia well API resources allow you to do is say I only want to send this information to the resource and so it's just another step that you have to think through of okay am I only sending the information I need and yes you might think hey Josh it's good to be security conscious yes it is it is very good but when I'm building things very quickly and I'm just like hey I want to get this idea out on the page

  16. I like just knowing I can use a blade template or use some server rendered PHP in my volt my Live Wire component and just say I just want the user name and I'm only displaying and retrieving the user's name I'm not displaying or retrieving the user's uh stripe token or the user's birthday and then last but not least the one of the things that I always like to come back to when it when

  17. people talk about okay should I use inertia and should I learn IA and use the skills that I have within view within react within spelt or should I learn Livewire and just go all in on the larel way and there's some great and fantastic videos great and fantastic resources I don't necessarily think it's uh US versus them I think it depends on your specific coding style your team's specific coding style and then what are

  18. you looking to do and how are you looking to build if you are like me you like building Scrappy let's create a new component within volt and I just want all of the logic in this one component until it gets a little bit too big for my liking and then I'm going to separate into different components and I just have everything where I need it yes it's going to be a new syntax for you where it's not going to look exactly or feel

  19. exactly like react or view or spelt but it allows you to get there scrappily it allows you to get there easily and allows you to get there quickly now if you're you like planning things out I think then inertia would be great for you because then you can say okay how am I going to do things in the cruddy way or I have this is a page that is you know uh create user then I have update user then I have delete user and

  20. I like having those separation concerns I like having things logically separated in all those aspects if that's how you think and how your brain works and program go for it that's awesome I love it for me that's not necessarily how my brain works I'm not as organized in my thoughts of how I'm building something I like to getting something on the page and again inertia is great for all of those items because you get the opportunity to think what specific

  21. information am I actually sending to the user when I'm passing in this users right here it even shows it on this page we only want to get the ID name email when you slow down and you're creating code with inertia it helps you think like this because okay what form do I need what route do I need what controller do I need in order to get this information it allows you to have those separation concerns between what

  22. is on the server what is on the client within volt doesn't necessarily within Livewire doesn't necessarily have the same concerns everything's kind of server and everything's kind of client and it's all intermingled you have this which just runs purely on the server but you also have all of this can be queried from the client and so you have to worry about Security in that aspect but it's more tightly knit in a way and for me I

  23. love that I love knowing okay all of this is server rendered and it's pass the client and then anything that a button that happens here it's an Ajax call to the server that helps me in a way instead of thinking in my mind of okay I have this form button and then I have this API route that I can access that inertia just gives me that glue to hold it all together and then the last thing I would try to say if you're just

  24. trying to decide between something like inertia with react view felt or something like Live Wire is the ecosystem and the community is fantastic for both sides of this there's so many things being built in Live Wire there's so many things being built within inertia regardless of how you think how you build what your style is within code you're going to find some great

  25. resources for it but if you're already used to this aspect of okay I have these three three or four react packages or three or four view packages how am I going to find something like that for laravel and Livewire then stick with view stick with react and use inertia or use nextjs and use felt kit and use Lille with the API just to start off with maybe using it with your cues or

  26. using it within mailing for example well if you're not necessarily uh concerned about that there are some options of okay I just want one page where I have Tremor to be able to display some react components there are some options mingle JS which allows you to have react and view code intermingled with your Live Wire components so

  27. there's options out there on both sides of the coin it all depends on really not what are you building I think there's benefits and disadvantages both sides of the coin for that of heavy server side heavy client and there's some things that both sides do really great again it's not an US versus them it's a how do you work how do you build how do you want things to look are you very

  28. organized and you like the separation of concerns between react the client side in your server or are you someone who just let's just start building things let's just make something happen and if I need a button on my front end to be able to talk to my back end really simply live wi might be for you so again the biggest part about this is you if you're

  29. still thinking of okay what are the things that I need to learn in order to build something within larel I already know view I already know react I already know spel I would say just start building something my personal opinion is maybe just start building something in Live Wire volt even if you don't know the syntax you you can get this I know you can I believe in you but even if you want to start with something like

  30. inertia just go do it just start building something just start creating something and as you go just keep creating

just you here