static-html.ts — astro Source File
Architecture documentation for static-html.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7c75f6a9_c903_7b77_f2b9_cea4c595b2e6["static-html.ts"] d9988dd0_c044_f9d2_85cd_a31a0a2bdf80["react"] 7c75f6a9_c903_7b77_f2b9_cea4c595b2e6 --> d9988dd0_c044_f9d2_85cd_a31a0a2bdf80 style 7c75f6a9_c903_7b77_f2b9_cea4c595b2e6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { createElement as h } from 'react';
/**
* Astro passes `children` as a string of HTML, so we need
* a wrapper `div` to render that content as VNodes.
*
* As a bonus, we can signal to React that this subtree is
* entirely static and will never change via `shouldComponentUpdate`.
*/
const StaticHtml = ({
value,
name,
hydrate = true,
}: {
value: string | null;
name?: string;
hydrate?: boolean;
}) => {
if (!value) return null;
const tagName = hydrate ? 'astro-slot' : 'astro-static-slot';
return h(tagName, {
name,
suppressHydrationWarning: true,
dangerouslySetInnerHTML: { __html: value },
});
};
/**
* This tells React to opt-out of re-rendering this subtree,
* In addition to being a performance optimization,
* this also allows other frameworks to attach to `children`.
*
* See https://preactjs.com/guide/v8/external-dom-mutations
*/
StaticHtml.shouldComponentUpdate = () => false;
export default StaticHtml;
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does static-html.ts do?
static-html.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in static-html.ts?
static-html.ts defines 1 function(s): StaticHtml.
What does static-html.ts depend on?
static-html.ts imports 1 module(s): react.
Where is static-html.ts in the architecture?
static-html.ts is located at packages/integrations/react/src/static-html.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/integrations/react/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free