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

199
Visualizações
How to return html string with react component's function

I have a react class component with these functions. Inside the componentDidUpdate, I would call generateHtml to get the html, and in the html, it will call bind a function called radioHandler. However, it showed an error that it could not find the function radioHandler when I click the radio button.

componentDidUpdate(){
    document.getElementById('spouseInfo').innerHTML = this.generateHtml()
}

generateHtml = () =>{
   return `<input name="${ele.$id.split("/")[3]}" onClick="${this.radioHandler}" type="radio" value="false"checked>` 
}

radioHandler = (event) => {
    // do something when click radio button
};





about 4 years ago · Santiago Trujillo
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