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

use-server-context.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { useContext } from "react";import ServerContext from "./server-context.js";
/** * @callback contextCallback * @param {import('../lib/types.ts').Context} context * @returns {Response | void} */
/** * @param {contextCallback | undefined} callback */export default function useServerContext(callback) { const context = useContext(ServerContext); if (context && callback) { const response = callback(context); if (response) { /** * TODO(deckchairlabs) how to set the response here, while keeping the server rendered markup * if desired */ } }}
ultra

Version Info

Tagged at
8 months ago