@microsoft/fast-element > render

render() function

Creates a RenderDirective for use in advanced rendering scenarios.

Signature:

export declare function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;

Parameters

Parameter

Type

Description

value

Expression<TSource, TItem> | Binding<TSource, TItem> | {}

(Optional) The binding expression that returns the data to be rendered. The expression can also return a Node to render directly.

template

ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>

(Optional) A template to render the data with or a string to indicate which RenderInstruction to use when looking up a RenderInstruction. Expressions can also be provided to dynamically determine either the template or the name.

Returns:

CaptureType<TSource, TParent>

A RenderDirective suitable for use in a template.

Remarks

If no binding is provided, then a default binding that returns the source is created. If no template is provided, then a binding is created that will use registered RenderInstructions to determine the view. If the template binding returns a string, then it will be used to look up a RenderInstruction to determine the view.