In this post I’ll show how to build a Rating component using Laravel Livewire. Laravel Livewire is a framework on top of Laravel to build dynamic applications without leaving the “comfort” of Laravel.
This is a preview of the complete application: In the red box I’ve highlighted the Rating component: You can click on the stars to give your rating, and both your rating and the average rating of all users is updated and displayed.
First, enable your pages to host Livewire components editing resources/views/layouts/app.blade.php and adding: Now, you can create the Rating component: The Rating component is split into a Blade template and a server-side component.
Keep in mind that a Livewire component is an end-to-end component, whereas a React/Vue component needs an API to interact with the back end.