Skip to content

Instantly share code, notes, and snippets.

@maxkoretskyi
Created April 17, 2019 11:55
Show Gist options
  • Save maxkoretskyi/f8a0621fdc9369f807217cdba5535075 to your computer and use it in GitHub Desktop.
Save maxkoretskyi/f8a0621fdc9369f807217cdba5535075 to your computer and use it in GitHub Desktop.
export class ReactComponent extends BaseReactComponent {
private eParentElement!: HTMLElement;
private createReactComponent(params: any, resolve: (value: any) => void) {
const ReactComponent = React.createElement(this.reactComponent, params);
const portal: ReactPortal = ReactDOM.createPortal(
ReactComponent,
this.eParentElement
);
this.portal = portal;
this.parentComponent.mountReactPortal(portal!, this, resolve);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment