Who is my parent component / parent name in Svelte 3

Viewed 1527

I have a component which is used by different kind of components (parents). This component's behaviour slightly depends on who is his parent (the kind of parent).

Ofcourse I can pass the parent's name as a prop or bind or ...

My question: Is it possible for the nested component to find out by itself who is the parent? during onMount?

1 Answers

No, and this is by design. If the parent and child components are designed to work together, they can communicate via props, events, or using the Context API.

Related