1.0.1 • Published 4 years ago
@shevsky/via-portal v1.0.1
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/>