silverwolf-x/project / packages /next /src /shared /lib /server-inserted-html.shared-runtime.tsx
silverwolf-x's picture
download
raw
806 Bytes
'use client'
import React, { useContext } from 'react'
export type ServerInsertedHTMLHook = (callbacks: () => React.ReactNode) => void
// Use `React.createContext` to avoid errors from the RSC checks because
// it can't be imported directly in Server Components:
//
// import { createContext } from 'react'
//
// More info: https://github.com/vercel/next.js/pull/40686
export const ServerInsertedHTMLContext =
React.createContext<ServerInsertedHTMLHook | null>(null as any)
export function useServerInsertedHTML(callback: () => React.ReactNode): void {
const addInsertedServerHTMLCallback = useContext(ServerInsertedHTMLContext)
// Should have no effects on client where there's no flush effects provider
if (addInsertedServerHTMLCallback) {
addInsertedServerHTMLCallback(callback)
}
}

Xet Storage Details

Size:
806 Bytes
·
Xet hash:
2d37aa8d793e4a5ad4f10766f55bb56836d390ff633a3fc4c31d2a4885f705f2

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.