UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

16 lines (15 loc) 628 B
import { createContext, useContext, useId } from "react"; const ServerHeadInsertions = {}, getServerHeadInsertions = id => { if (ServerHeadInsertions[id]) return Object.values(ServerHeadInsertions[id]); }, ServerRenderID = createContext(""), useServerHeadInsertion = callback => { if (typeof window > "u") { const insertionID = useId(), id = useContext(ServerRenderID); ServerHeadInsertions[id] ||= {}, ServerHeadInsertions[id][insertionID] = callback; } }; export { ServerRenderID, getServerHeadInsertions, useServerHeadInsertion }; //# sourceMappingURL=useServerHeadInsertion.mjs.map