UNPKG

@tanstack/solid-router

Version:

Modern and scalable routing for Solid applications

27 lines (26 loc) 979 B
import { Asset } from "./Asset.js"; import { useTags } from "./headContentUtils.js"; import { createComponent } from "solid-js/web"; import { For } from "solid-js"; import { MetaProvider } from "@solidjs/meta"; //#region src/HeadContent.tsx /** * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route. * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>` * to ensure it's part of the reactive tree and updates correctly during client-side navigation. * The component uses portals internally to render content into the `<head>` element. */ function HeadContent() { const tags = useTags(); return createComponent(MetaProvider, { get children() { return createComponent(For, { get each() { return tags(); }, children: (tag) => createComponent(Asset, tag) }); } }); } //#endregion export { HeadContent }; //# sourceMappingURL=HeadContent.js.map