@lmnl/portal
v0.0.5
Published
Portal allows you to define components as you normally would, and output them to an `<Outlet />` somewhere else in your app e.g. rendering a modal at the root.
Downloads
8
Readme
lmnl portal
Portal allows you to define components as you normally would, and output them to
an <Outlet />
somewhere else in your app e.g. rendering a modal at the root.
// Root.tsx
import { Provider, Outlet } from '@lmnl/portal'
export function Root() {
return (
<View>
<App />
<Outlet />
</View>
)
}
// components/Component.tsx
import { Portal } from '@lmnl/portal'
export function Component() {
return (
<View>
<Text>My nested component</Text>
<Portal>
{/* Renders to <Outlet /> on mount */}
<PortaledComponent />
</Porta>
</View>
)
}