Inject React node into any position in React tree.
import { usePortal, PortalIn } from '@-ft/react-portal';
function MyPage({ children }) {
const { append, PortalOut } = usePortal();
return (
<Layout>
<SomeOtherComponent>
<MyComponent append={append} />
</SomeOtherComponent>
<PortalOut />
</Layout>
);
}
function MyComponent({ append }) {
return (
<PortalIn append={append}>
<DirectBottomOfLayout />
</PortalIn>
);
}