Having a scenario with two distinct components:
<parent-component type="permanent">
<div child-component></div>
</parent-component>
class ParentComponentCustomElement {
@bindable public type: string = "permanent";
}
class ChildComponentCustomAttribute {
public attached() {
// How exactly can I access the instance of ParentComponentCustomElement from here?
}
}
The main goal is to retrieve the value of the type
property in the parent component so that we can dynamically apply classes to the child component based on certain conditions.
I have considered traversing through the DOM tree to find the specific parent component, but I believe there must be a better approach to achieve this.