Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / index / registerComponent

Function: registerComponent()

registerComponent(PageClass, path?): void

Defined in: flow/src/registry.ts:60

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

The Component subclass to register.

path?

string = ""

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

Returns

void

Example

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