ClientComponent
interfaz
Forma pública de un módulo .meeko compilado que necesita mountClientApp para renderizar e
hidratar páginas y layouts.
ts
import type { ClientComponent } from "@meekojs/meeko/framework";Código fuente src/app/runtime/client.ts:63
Declaración #
ts
interface ClientComponent {
renderWithState(props: Record<string, unknown>): { html: string; state: Record<string, unknown> }
renderToString(props: Record<string, unknown>, state?: Record<string, unknown>): string
hydrateScope(scope: DomScope, props: Record<string, unknown>, state?: Record<string, unknown>): () => void
}Ejemplo #
ts
import type { ClientComponent } from "@meekojs/meeko/framework";
import { modules as pages } from "virtual:meeko-client-pages";
async function loadPage(file: string): Promise<ClientComponent> {
const load = pages[file];
if (!load) throw new Error(`Page module missing: ${file}`);
return await load() as ClientComponent;
}Miembros #
renderWithState
#
renderWithState(props: Record<string, unknown>): { html: string; state: Record<string, unknown> }Renderiza el HTML y captura el estado de sus señales.
renderToString
#
renderToString(props: Record<string, unknown>, state?: Record<string, unknown>): stringRenderiza el HTML, opcionalmente desde un estado capturado.