<!-- 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

|  Parameter | Type | Description |
|  --- | --- | --- |
|  component | ComponentPublicInstance \| null | The component to find its root XComponent. |

**Returns:**

ComponentPublicInstance \| undefined

The root XComponent or undefined if it has not.

