# @zerolith/router/server

Import from `@zerolith/router/server`. Generated from the source; every signature below is what the published types declare.

## Functions

### renderHead

```ts
function renderHead(head: Head): string
```

Renders head metadata as the `<title>` and `<meta name="description">` elements of a server-rendered document.

Source: `packages/router/src/server.ts:8`

### renderRouteState

```ts
function renderRouteState(router: Router<RouteTable>): string
```

Renders the `<script>` that hands the current route's loaded data to the
browser, where the router reuses it for the initial navigation instead of
running the loader again, as long as the route and URL still match.
Empty when nothing matched or the route produced no data. The data goes
through JSON, so the browser's first navigation receives the JSON form: a
`Date` arrives as a string, a `Map` as an empty object, a field holding
`undefined` is left out, and a `BigInt` throws here. Return plain JSON
from a loader whose page is server-rendered.

Source: `packages/router/src/server.ts:32`

