deno.land / x / ultra@v2.3.8 / hooks / use-preload.js

use-preload.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { createElement as h } from "react";import useServerInsertedHTML from "./use-server-inserted-html.js";
/** * This hook will insert a `<link rel="preload" />` tag into the head of the * server render document. During client side transitions, this won't do anything. * * @param {string} href * @param {React.LinkHTMLAttributes<HTMLLinkElement>} props */export default function usePreload(href, props) { useServerInsertedHTML(() => { return h("link", { rel: "preload", href, ...props, }); });
return href;}
ultra

Version Info

Tagged at
8 months ago