Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

ComponentModule

interfaz

Contrato de un módulo de componente compilado para componerlo sin elemento envolvente. A diferencia de Component, renderWithState es opcional: sirve para usos de bajo nivel que renderizan sin transferir estado.

ts
import type { ComponentModule } from "@meekojs/meeko";

Source code src/app/runtime/renderer.ts:61

Declaración #

ts
interface ComponentModule<Props extends object> {
	readonly renderToString: (props: Props, state?: Record<string, unknown>) => string
	readonly renderWithState?: (props: Props) => { html: string; state: Record<string, unknown> }
	readonly hydrateScope: (scope: DomScope, props: Props, state?: Record<string, unknown>) => ComponentRelease
}

Type parameters #

Props extends object

Props del componente.

Example #

ts
import type { ComponentModule } from "@meekojs/meeko";

function renderAll<P extends object>(module: ComponentModule<P>, list: readonly P[]): string {
  return list.map((props) => module.renderToString(props)).join("");
}

Propiedades #

renderToString #

propiedad sólo lectura

readonly renderToString: (props: Props, state?: Record<string, unknown>) => string

Renderiza el HTML, opcionalmente desde un estado capturado.

renderWithState #

propiedad sólo lectura opcional

readonly renderWithState?: (props: Props) => { html: string; state: Record<string, unknown> }

Renderiza el HTML y captura el estado de sus señales.

hydrateScope #

propiedad sólo lectura

readonly hydrateScope: (scope: DomScope, props: Props, state?: Record<string, unknown>) => ComponentRelease

Hidrata el HTML de scope; devuelve la función de liberación.

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/app/runtime/renderer.ts