<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [getRootXComponent](./x-components.getrootxcomponent.md)

## getRootXComponent() function

Given a component, finds the root XComponent in the ancestors hierarchy.

**Signature:**

```typescript
export declare function getRootXComponent(component: ComponentPublicInstance | null): ComponentPublicInstance | undefined;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

component


</td><td>

ComponentPublicInstance \| null


</td><td>

The component to find its root XComponent.


</td></tr>
</tbody></table>

**Returns:**

ComponentPublicInstance \| undefined

The root XComponent or undefined if it has not.

