• Renders a template (function) to into an HTML element. The template needs to return a valid HTML string (with a single root element). A context with key/value pairs will be passed into the template to allow dynamic rendering.

    Type Parameters

    • El = HTMLElement

      is the type of the rendered dom element.

    • Context = Record<string, unknown>

      is the shape of the context data object

    Parameters

    • template: ((context: Context) => string)

      a function to render a template

        • (context): string
        • Parameters

          Returns string

    • context: Context

      context data for the template

    Returns El | null

    the rendered htmml element