Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Last active August 30, 2022 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/9dd7552f72da091f9fc123318d5cab03 to your computer and use it in GitHub Desktop.
Save NetanelBasal/9dd7552f72da091f9fc123318d5cab03 to your computer and use it in GitHub Desktop.
// ... THE CONTEXT CODE IS ABOVE ...
@Injectable({ providedIn: 'root' })
export class NgReact {
injector = inject(Injector);
createRoot(host: HTMLElement) {
return createRoot(host);
}
render<Comp extends ElementType>(
root: Root,
Comp: Comp,
compProps?: ComponentProps<Comp>
) {
root.render(
createElement(NgContext, {
injector: this.injector,
}, createElement(Comp, compProps))
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment