You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/client/shared/components/Portal/context.ts

15 lines
453 B
TypeScript

import React from 'react';
export type PortalMethods = {
mount: (name: string, children: React.ReactNode) => number;
update: (name: string, key: number, children: React.ReactNode) => void;
unmount: (name: string, key: number) => void;
};
export function createPortalContext(name: string) {
const PortalContext = React.createContext<PortalMethods | null>(null);
PortalContext.displayName = 'PortalContext-' + name;
return PortalContext;
}