Skip to content

Instantly share code, notes, and snippets.

@lacolaco
lacolaco / 1.ngx-reactify.tsx
Last active September 11, 2024 09:51
A React component to render a standalone Angular component (Angular v14.2 is required)
import { ApplicationRef, ComponentRef, createComponent, Type } from "@angular/core";
import { createApplication } from "@angular/platform-browser";
import React, { useEffect, useRef, useState } from "react";
type AnyComponentRef = ComponentRef<unknown>;
export type ReactifyProps = {
component: Type<unknown>;
inputs?: Record<string, unknown>;
};