0.0.10 • Published 1 year ago

@-ft/react-portal v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-portal - The real React Portal, not a ReactDOM Portal

Inject React node into any position in React tree.

Usage

import { usePortal } 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>
  );
}
0.0.10

1 year ago

0.0.9

1 year ago