-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServerContextContext.mjs
30 lines (25 loc) · 1.09 KB
/
ServerContextContext.mjs
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
26
27
28
29
30
// @ts-check
import React from "react";
/**
* [Node.js](https://nodejs.org) HTTP server context.
* @typedef {object} ServerContext
* @prop {import("node:http").IncomingMessage} request
* [Node.js HTTP server request instance](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
* @prop {import("node:http").ServerResponse} response
* [Node.js HTTP server response instance](https://nodejs.org/api/http.html#http_class_http_serverresponse).
*/
/**
* [React context](https://reactjs.org/docs/context.html) for a
* {@linkcode ServerContext} object. Chances are you won’t have to interact with
* this directly.
*/
const ServerContextContext = React.createContext(
/** @type {ServerContext | undefined} */ (undefined),
);
if (typeof process === "object" && process.env.NODE_ENV !== "production")
/**
* The display name.
* @see [React display name conventions](https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging).
*/
ServerContextContext.displayName = "ServerContextContext";
export default ServerContextContext;