@misa198/react-slots
Version:
A simple react component that uses slots to render children
22 lines (16 loc) • 495 B
TypeScript
import * as react from 'react';
import { ReactNode } from 'react';
interface SlotBody {
element: JSX.Element;
}
interface Slots {
[key: string]: SlotBody;
}
declare function Slot({ element }: SlotBody): react.FunctionComponentElement<any> | null;
interface Props {
children: JSX.Element;
name: string;
}
declare function SlotWrapper(_: Props): null;
declare const useSlots: (children?: ReactNode) => Slots;
export { Slot, type SlotBody, SlotWrapper, type Slots, useSlots };