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

146
Visualizações
Is there any way I can update a mounted React node's props in my current setup?

So I have a mounted React application that is rendered like this (it's via another framework on top):

const componentRender = (entryComponent, initialProps, targetNode) => {
 const root = createRoot(targetNode);
 const element = createElement(entryComponent, initialProps);
  const wrapper = createElement(SomeWrapper, null, element);
  root.render(wrapper);
}

On top level, I call:

Ext.extend(Ext.Container, {
  listeners: {
    afterrender: function () {
     this.root = componentRender(
        MyComponent,
        this.myProps,
        domElement
      );
    },
  },
 constructor: function (...args) {
    Object.assign(this, args);
  },
onServerSuccess: function(data) {
// here is where I receive new data 
    this.myProps = data;
}
});

In essence, when the EXT component loads, I insert React into the page. So what I can do is onServerSuccess (when I receive the data I want), I can use this.root.unmount() and mount the component again. However, mounting and unmounting repeatedly is not really the best solution. What I'm trying to do is perhaps to make this.myProps "reactive" so whenever they change, the component knows and re-renders without having to be unmounted and re-mounted again.

Maybe there's a better solution out there?

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