Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
React HtmlElement Micro Front end is not reloading in Shell Application

I am trying to inject below react mfe into another angular shell application. But, it is loading first time, but when they hide or remove from dom and then again it is not able to load.

Can you please help what is wrong in below code so that they can reload or hide/show properly.

Thanks in advance.

import React, { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import AchPayment from "./AchPayment";
//import createCustomElement from "react-custom-element-builder";

const mount = (el, props) => {
  const { consumerName, token, achTransactionRequest } = props;
  const root = createRoot(el!);

  if (consumerName) {
    if (
      consumerName.toUpperCase() == "APEX" ||
      consumerName.toUpperCase() == "MYFINANCING"
    ) {
      class AchPaymentElement extends HTMLElement {
        connectedCallback() {
          root.render(
            <div>
              <AchPayment {...props} />
            </div>
          );
        }
      }

      customElements.get("ach-payment-element") ||
        customElements.define("ach-payment-element", AchPaymentElement);
    } else {
      return root.render(<h1>Invalid Consumer !</h1>);
    }
  } else {
    return root.render(<h1>Invalid Consumer !</h1>);
  }
};
const props = {
  consumerName: "MyFinancing",
};
const devRoot = document.querySelector("#_myMfe");
mount(devRoot, props);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda