Skip to main content
Module

x/aleph/framework/react/portal.ts>usePortal

The Full-stack Framework in Deno.
Very Popular
Latest
function usePortal
import { usePortal } from "https://deno.land/x/aleph@1.0.0-beta.44/framework/react/portal.ts";

The usePortal hook to create a portal node. Please ensure to pass the React.createPortal in Router props.

function Modal() {
  const portal = usePortal({ type: "dialog", preventScroll: true });
  return portal(<p>Hello portal!</p>);
}

Parameters

optional
props: { key?: string | null; className?: string; lockScroll?: boolean; type?: "div" | "dialog"; }

Returns

(children: ReactNode) => ReactPortal | null