Skip to content

ParentContext type

Home > @rimitive/view > ParentContext

Parent context passed to RefSpec.create() for adapter composition Allows child RefSpecs to know their parent’s adapter and element

Note: adapter uses ‘unknown’ for variance - any Adapter is assignable

Signature:

export type ParentContext<TElement> = {
adapter: unknown;
element: TElement;
};
import type { ParentContext } from '@rimitive/view/types';
const context: ParentContext<HTMLElement> = {
adapter: domAdapter,
element: parentElement
};
// Used internally when creating child elements
const childRef = childSpec.create(svc, {}, context);