smolter
API

Links

Render the root module’s document link descriptors.

Compatibility

ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.

Import from @kasperrt/smolter/preact/document @kasperrt/smolter/react/document

Signature

function Links(): import("preact").JSX.Element;

Parameters

Takes no props and requires application context. Reads the links function from the root module.

Returns

Renders one link element per descriptor returned by rootModule.links. With no links function, renders no link elements.

Example

Use this for stylesheets, icons, and resource hints declared by the application root. Keep deployment-specific asset URLs in the application.

import { Links, Meta } from "@kasperrt/smolter/preact/document";

export function DocumentHead() {
  return (
    <head>
      <meta charSet="utf-8" />
      <Meta />
      <Links />
    </head>
  );
}

Scope

Links does not discover fonts, generate CDN URLs, or load root data. Root links and route metadata are separate: route-level link descriptors can be returned by meta using tagName: "link".

View implementation ↗