@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
12 lines • 461 B
JavaScript
import * as React from 'react';
export const PortalContext = /*#__PURE__*/React.createContext(undefined);
if (process.env.NODE_ENV !== 'production') {
PortalContext.displayName = 'PortalContext';
}
export function usePortalContext() {
const context = React.useContext(PortalContext);
if (context === undefined) {
throw new Error('Base UI: PortalContext is missing. Portal parts must be placed within the Root of a component.');
}
return context;
}