1.0.1 • Published 3 years ago

@shevsky/via-portal v1.0.1

Weekly downloads
43
License
MIT
Repository
github
Last release
3 years ago

Wrap components to portal

Example

import { viaPortal } from '@shevsky/via-portal';
import React, { PropsWithChildren } from 'react';

type TFooProps = PropsWithChildren<{}>;

export const Foo = viaPortal((props: TFooProps): JSX.Element => {
  return (
    <div className="foo">
      {props.children}
    </div>
  );
}, 'foo'); // Would be rendered to <div data-foo-portal/> at the end of <body/>