Skip to content

Functional Components context.parent is root instance  #4550

@alidcast

Description

@alidcast

Let's say I have the following template:

<div id="app">
   <parent-component>
      <functional-child-component />
      <normal-child-component />
   </ parent-component>
</div>

If I use this.$parent inside the normal-child-component I get access to the parent-component, as expected.

If I use the same logic inside a functional child component, however, the behavior is different. context.parent gives me access to the root instance, similar to if I was using this.$root in a normal component. Is this the intended behavior? If it is, how can I get access to actual $parent instance inside a functional child component?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions