Caleb Porzio - Embrace The Backend
HTML-код
- Опубликовано: 8 сен 2024
- Caleb Porzio gives a talk at Laracon 2018. In the talk, Caleb, a Tighten developer and 20% Time Podcast Host, talks about embracing the backend to make your apps cleaner, more efficient and easier to manage.
This speech should be named "The Origin of Livewire"
Very nice and definitely highly entertaining talk :)!
If you want to use vanilla javascript and blade what was the point of using vue in the first place ?! and what is the point of having API endpoint for this! do you really call this a refactor !!
I know what you said, probably this was not the best example, but I get the main idea. You can do "laravel good" to make small vue components
What a great talk... I actually started doing this too... I don't feel so bad now... lol I still like to componentize (is that even a word) with Vue... I think the single file components are great to keep front end logic in one place and make reusable cards/components... but with limited logic. Right tools for the right application... SPA/PWAs naturally are another thing all together... but when doing straight web apps... seems to me much easier that way...
Strange talk. Went from frontend heavy rendered app to a mix/match backend rendered approach. May as well gone the full hog and just rendered everything with blade rather than in a Vue component. The easier unit testing points were very interesting though.
Read between the lines. He didn't say that you should always do this, and that this is the be-all and end-all way. His talk is "Embrace The Backend". The point to takeaway is that when appropriate, it's less complex when you utilise the backend more.
does that means that we should completley seperate both ? like making a seperate vue js project and connecting to laravel via webservices ?
not always, in my case, I'm developing a large monolitic ecommerce and I'm the only developer. I have no time to separate backend and frontend, but I have organized my vue componentes like caleb does, tiny controllers, etc with all best practices, and it looks good.
This wont work for a Server-side-rendered app, would it?
I kinda do the same thing but I handle the form inside in a Vue Submit method with an axios.post.
If a validation error returns on the axios.catch, laravel puts all errors inside the error.response variable from the catch, so you can use it to show all the errors on the corresponding inputs.
If request was successful, I call a window.reload or redirect because that shows also any Flash method notification used on the Controller
Why? If you can get the data from the server on page load rather than kicking off a bunch of requests on created() to get that data and showing a bunch of loading spinners, the UX is better. All of the data is still in Vue and still reactive and still makes the UI better while users are using it, but the initial page load can be better. I probably won't go down the form post route or anything, but will definitely use the blade driven props when I can.
This one is huge. So huge
Summary: Don't use vue. Just use plain old blade template. That't it!
Don't watch the full video.. It's just a waste of time.
I have my components like Caleb has, the advantage is that i still can use axios an reactive components when a component need it
I am glad there are other people in the world who see how much vue sucks 😂
I do not like this. This does not work for an app with a lot of interactivity. This example is not more complex then a todo app. Why do you need vue at all for something this simple?