Skip to content

Initializing a component with a "Post" #2937

@Nek-

Description

@Nek-

The documentation states that a LiveProp may be an entity however there's no example of how to instantiate the component with the entity. And... There are tricks here!

In my case I had a mount() function:

#[LiveProp]
public Post $post;

public function mount(Post $post)
{
    // .. doing something
}

It's actually required here to hydrate manually the prop:

#[LiveProp]
public Post $post;

public function mount(Post $post)
{
    $this->post = $post;
    // .. doing something
}

More like a doc issue than an actual problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LiveComponentdocsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions