Home / Function/ renderComponent() — astro Function Reference

renderComponent() — astro Function Reference

Architecture documentation for the renderComponent() function in component.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0["renderComponent()"]
  8fc97f1b_c914_c155_013d_cbd729fb6b4f["component.ts"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|defined in| 8fc97f1b_c914_c155_013d_cbd729fb6b4f
  320325ac_8531_4bc4_5528_be7eec9a3143["renderComponentToString()"]
  320325ac_8531_4bc4_5528_be7eec9a3143 -->|calls| 94f21ea8_f0e7_2f4c_ee40_699f26c9ede0
  bef94f5f_b86b_5067_ed94_199664d8c795["isFragmentComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| bef94f5f_b86b_5067_ed94_199664d8c795
  b8c882f5_a42f_b065_eb12_bfb3dc3ff9ed["renderFragmentComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| b8c882f5_a42f_b065_eb12_bfb3dc3ff9ed
  c890edbc_02d8_740c_975b_be0cbfc1b8ad["normalizeProps()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| c890edbc_02d8_740c_975b_be0cbfc1b8ad
  3150d0a0_3d9e_69e2_911a_1bbd2d0b3bd9["isHTMLComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| 3150d0a0_3d9e_69e2_911a_1bbd2d0b3bd9
  6f2499fd_5163_c84a_13ac_b343beae6c61["renderHTMLComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| 6f2499fd_5163_c84a_13ac_b343beae6c61
  861f20ba_fad0_c4de_c8fc_720d824ef3e0["renderAstroComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| 861f20ba_fad0_c4de_c8fc_720d824ef3e0
  d89f42fe_2e3e_d985_e361_b90a7e5694d4["renderFrameworkComponent()"]
  94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 -->|calls| d89f42fe_2e3e_d985_e361_b90a7e5694d4
  style 94f21ea8_f0e7_2f4c_ee40_699f26c9ede0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/render/component.ts lines 463–503

export function renderComponent(
	result: SSRResult,
	displayName: string,
	Component: unknown,
	props: Record<string | number, any>,
	slots: ComponentSlots = {},
): RenderInstance | Promise<RenderInstance> {
	if (isPromise(Component)) {
		return Component.catch(handleCancellation).then((x) => {
			return renderComponent(result, displayName, x, props, slots);
		});
	}

	if (isFragmentComponent(Component)) {
		return renderFragmentComponent(result, slots).catch(handleCancellation);
	}

	// Ensure directives (`class:list`) are processed
	props = normalizeProps(props);

	// .html components
	if (isHTMLComponent(Component)) {
		return renderHTMLComponent(result, Component, props, slots).catch(handleCancellation);
	}

	if (isAstroComponentFactory(Component)) {
		return renderAstroComponent(result, displayName, Component, props, slots);
	}

	return renderFrameworkComponent(result, displayName, Component, props, slots).catch(
		handleCancellation,
	);

	function handleCancellation(e: unknown) {
		if (result.cancelled)
			return {
				render() {},
			};
		throw e;
	}
}

Domain

Subdomains

Frequently Asked Questions

What does renderComponent() do?
renderComponent() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/component.ts.
Where is renderComponent() defined?
renderComponent() is defined in packages/astro/src/runtime/server/render/component.ts at line 463.
What does renderComponent() call?
renderComponent() calls 7 function(s): isFragmentComponent, isHTMLComponent, normalizeProps, renderAstroComponent, renderFragmentComponent, renderFrameworkComponent, renderHTMLComponent.
What calls renderComponent()?
renderComponent() is called by 1 function(s): renderComponentToString.

Analyze Your Own Codebase

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

Try Supermodel Free