@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
22 lines (20 loc) • 839 B
JavaScript
'use client';
import * as React from 'react';
/**
* Carries the data the fallback hoisted down into the full content. A
* `CoordinatedLazy` provides it around `content` after the swap; content reads
* it via {@link useCoordinatedContent}.
*/
export const CoordinatedContentContext = /*#__PURE__*/React.createContext({
hoisted: {}
});
/**
* Read the data the fallback hoisted, from inside the full content. Lets the
* content use what the fallback fetched (e.g. a decompression dictionary)
* without the consumer threading it through props. Returns an empty map when
* rendered outside a `CoordinatedLazy`.
*/
if (process.env.NODE_ENV !== "production") CoordinatedContentContext.displayName = "CoordinatedContentContext";
export function useCoordinatedContent() {
return React.useContext(CoordinatedContentContext).hoisted;
}