The mount() method

Initial Parameters

You can pass data into a component by passing additional parameters into the @livewire directive. For example, let's say we have a ShowContact Livewire component that needs to know which contact to show. Here's how you would pass in the contact id.

@livewire('show-contact', $contactId)
use Livewire\Component;

class ShowContact extends Component
    public $name;
    public $email;

    public function mount($id)
        $contact = User::find($id);

        $this->name = $contact->name;
        $this->email = $contact->email;


You can pass multiple parameters to the mount() hook and receive them like so:

@livewire('show-contact', $contactId, $profilePhotoUrl)
← Previous Topic

State Management

Next Topic →

Data Binding