Buckets:
| /* eslint-disable @next/internal/no-ambiguous-jsx -- whole module is used in React Client */ | |
| // Provider for the `useServerInsertedHTML` API to register callbacks to insert | |
| // elements into the HTML stream. | |
| import type { JSX, ReactNode } from 'react' | |
| import * as ReactClient from 'react' | |
| import { ServerInsertedHTMLContext } from '../../shared/lib/server-inserted-html.shared-runtime' | |
| export function createServerInsertedHTML() { | |
| const serverInsertedHTMLCallbacks: (() => ReactNode)[] = [] | |
| const addInsertedHtml = (handler: () => ReactNode) => { | |
| serverInsertedHTMLCallbacks.push(handler) | |
| } | |
| return { | |
| ServerInsertedHTMLProvider({ children }: { children: JSX.Element }) { | |
| return ( | |
| <ServerInsertedHTMLContext.Provider value={addInsertedHtml}> | |
| {children} | |
| </ServerInsertedHTMLContext.Provider> | |
| ) | |
| }, | |
| renderServerInsertedHTML() { | |
| return serverInsertedHTMLCallbacks.map((callback, index) => ( | |
| <ReactClient.Fragment key={'__next_server_inserted__' + index}> | |
| {callback()} | |
| </ReactClient.Fragment> | |
| )) | |
| }, | |
| } | |
| } | |
Xet Storage Details
- Size:
- 1.1 kB
- Xet hash:
- 5bd3c63df63d6160db90f630556843604f95bb80cbee8f5ef7e274b52f281c2d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.