Last active
August 30, 2022 06:03
-
-
Save NetanelBasal/9dd7552f72da091f9fc123318d5cab03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... 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