Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda