Q1: How does Livewire work under the hood?
Livewire renders the initial component output with the page (SEO friendly). When an interaction occurs (e.g., click):
- Livewire sends an AJAX request to the server with the component state.
- The server runs the method, updates the state, and re-renders the Blade view.
- The server sends back the new HTML.
- Livewire intelligently morphs the DOM to match the new HTML without a full reload.
Q2: What is the purpose of wire:model.live vs wire:model in Livewire 3?
In Livewire 3, wire:model is deferred by default. It only sends a request when an action (like submit) is performed, saving network requests.
wire:model.live sends a request to the server immediately upon input (like debounce), useful for real-time search or validation.
Q3: How do you share state between Livewire and Alpine.js?
Using the @entangle directive.
This creates a two-way binding bridge between the client-side Alpine state and server-side Livewire property.
Q4: What is Filament and why would you use it?
Filament is a collection of tools for building admin panels, forms, and tables powered by the TALL stack.
Benefits:
- Speed: Generates CRUD interfaces in minutes.
- Consistency: Provides a unified UI/UX.
- Extensibility: Built on Livewire, so you can create custom widgets and pages easily.