Home / Function/ renderChild() — astro Function Reference

renderChild() — astro Function Reference

Architecture documentation for the renderChild() function in any.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  033d3df7_8875_dc4e_f964_c42d13fcdeef["renderChild()"]
  0e818d99_0299_a58a_f7c7_b3fe5a5b3548["any.ts"]
  033d3df7_8875_dc4e_f964_c42d13fcdeef -->|defined in| 0e818d99_0299_a58a_f7c7_b3fe5a5b3548
  2e6b3a48_deda_e439_87c1_f350f615f871["renderArray()"]
  2e6b3a48_deda_e439_87c1_f350f615f871 -->|calls| 033d3df7_8875_dc4e_f964_c42d13fcdeef
  017350ba_ffbc_b7cc_d218_9fcd56d32355["renderIterable()"]
  017350ba_ffbc_b7cc_d218_9fcd56d32355 -->|calls| 033d3df7_8875_dc4e_f964_c42d13fcdeef
  0ce64933_7ce4_4de3_1bf2_69adbb565abe["renderAsyncIterable()"]
  0ce64933_7ce4_4de3_1bf2_69adbb565abe -->|calls| 033d3df7_8875_dc4e_f964_c42d13fcdeef
  2e6b3a48_deda_e439_87c1_f350f615f871["renderArray()"]
  033d3df7_8875_dc4e_f964_c42d13fcdeef -->|calls| 2e6b3a48_deda_e439_87c1_f350f615f871
  0ce64933_7ce4_4de3_1bf2_69adbb565abe["renderAsyncIterable()"]
  033d3df7_8875_dc4e_f964_c42d13fcdeef -->|calls| 0ce64933_7ce4_4de3_1bf2_69adbb565abe
  017350ba_ffbc_b7cc_d218_9fcd56d32355["renderIterable()"]
  033d3df7_8875_dc4e_f964_c42d13fcdeef -->|calls| 017350ba_ffbc_b7cc_d218_9fcd56d32355
  style 033d3df7_8875_dc4e_f964_c42d13fcdeef fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/render/any.ts lines 8–70

export function renderChild(destination: RenderDestination, child: any): void | Promise<void> {
	if (isPromise(child)) {
		return child.then((x) => renderChild(destination, x));
	}

	if (child instanceof SlotString) {
		destination.write(child);
		return;
	}

	if (isHTMLString(child)) {
		destination.write(child);
		return;
	}

	if (Array.isArray(child)) {
		return renderArray(destination, child);
	}

	if (typeof child === 'function') {
		// Special: If a child is a function, call it automatically.
		// This lets you do {() => ...} without the extra boilerplate
		// of wrapping it in a function and calling it.
		return renderChild(destination, child());
	}

	if (!child && child !== 0) {
		// do nothing, safe to ignore falsey values.
		return;
	}

	if (typeof child === 'string') {
		destination.write(markHTMLString(escapeHTML(child)));
		return;
	}

	if (isRenderInstance(child)) {
		return child.render(destination);
	}

	if (isRenderTemplateResult(child)) {
		return child.render(destination);
	}

	if (isAstroComponentInstance(child)) {
		return child.render(destination);
	}

	if (ArrayBuffer.isView(child)) {
		destination.write(child);
		return;
	}

	if (typeof child === 'object' && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
		if (Symbol.asyncIterator in child) {
			return renderAsyncIterable(destination, child);
		}

		return renderIterable(destination, child);
	}

	destination.write(child);
}

Domain

Subdomains

Frequently Asked Questions

What does renderChild() do?
renderChild() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/any.ts.
Where is renderChild() defined?
renderChild() is defined in packages/astro/src/runtime/server/render/any.ts at line 8.
What does renderChild() call?
renderChild() calls 3 function(s): renderArray, renderAsyncIterable, renderIterable.
What calls renderChild()?
renderChild() is called by 3 function(s): renderArray, renderAsyncIterable, renderIterable.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free