deno.land / x / fresh@1.1.1 / src / runtime / head.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { ComponentChildren, createContext } from "preact";import { useContext } from "preact/hooks";
export interface HeadProps { children: ComponentChildren;}
export const HEAD_CONTEXT = createContext<ComponentChildren[]>([]);
export function Head(props: HeadProps) { let context: ComponentChildren[]; try { context = useContext(HEAD_CONTEXT); } catch (err) { throw new Error( "<Head> component is not supported in the browser, or during suspense renders.", { cause: err }, ); } context.push(props.children); return null;}
fresh

Version Info

Tagged at
a year ago