[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/flow](../../README) / [index](../README) / registerComponent

# Function: registerComponent()

> **registerComponent**(`PageClass`, `path?`): `void`

Defined in: [flow/src/registry.ts:60](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/registry.ts#L60)

Register a Component class that is used as a nested component (no route of its
own). Called automatically the first time a parent embeds it via
`this.child(...)`; call it explicitly from a provider when child components
must survive a server restart before any parent page has been rendered.

Registration is keyed by the class's constructor name and is idempotent — a class
already registered (e.g. via `Router.flow()`) is left untouched, so the `path` here
only applies to a first-time, routeless registration.

## Parameters

### PageClass

*typeof* [`Component`](../classes/Component)

The Component subclass to register.

### path?

`string` = `""`

Route path to associate; defaults to `""` for a nested (routeless) component.

## Returns

`void`

## Example

```ts
// In a ServiceProvider's boot method:
registerComponent(CounterWidget);
```
