I’ve been playing around a bit with Livewire and am just curious what other people’s approach is to using it. So, when do you reach for a Livewire component and when do you reach for other solutions (i.e. plain form submission, frontend framework, etc)?
A rule that I have for myself is that if I’m just showing/hiding something like a modal or form, I will reach for AlpineJS since it is going to be snappier. Also, Livewire seems perfect for things that Caleb has demoed it with, building user/post/repo searches.
The thing I get hung up the most on is, when do plain form submissions make more sense. I started playing around with creating an “Edit Profile” component that would allow you to update things like your name, phone number, etc. The further I got with making it the more I started to think that a plain form submission would be best because I would run into weird issues where the value in the rendered view would be out of sync with the value stored in the component on the backend. If I typed too fast and hit the submit button too quickly I would run into race conditions (I did fix this by adjusting debounce and using the wire:loading attribute).
Does anyone with more experience with the framework have any guidelines or best practices when determining what should be a component and how it should be implemented?