@winglet/react-utils
Version:
React utility library providing custom hooks, higher-order components (HOCs), and utility functions to enhance React application development with improved reusability and functionality
12 lines (11 loc) • 665 B
TypeScript
import { type ComponentType } from 'react';
/**
* Higher-Order Component (HOC) that wraps a component with Portal context provider.
* Components wrapped with this HOC can use Portal components to render content at different DOM locations.
* @typeParam T - The component props type
* @param Component - The component to wrap with Portal context
* @returns A memoized component wrapped with Portal context provider
* @example
* const MyPortalComponent = Portal.with(MyComponent);
*/
export declare const withPortal: <T extends object>(Component: ComponentType<T>) => import("react").MemoExoticComponent<(props: T) => import("react/jsx-runtime").JSX.Element>;