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

153
Visualizações
embeded HTML doesn't show on react page

I am trying to ad some gofundme donation buttons on a react page but it doesn't even show on screen.

const Donation = () => {
    return (
        <div>
            <div className="gfm-embed" data-url="https://www.gofundme.com/f/theyre-the-real-victims/widget/large/"></div>
            <script defer src="https://www.gofundme.com/static/js/embed.js"></script>
        </div>
    )
}
    
export default Donation

I have neve done anything like this before. Any help will be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

React uses innerHTML to add elements to the DOM. innerHTML disables execution of script tags.

HTML5 specifies that a tag inserted with innerHTML should not execute.

So, the recommended way to include script tags is via the useEffect hook

const Donation = () => {

  useEffect(() => {
    const script = document.createElement('script');

    script.src = "https://www.gofundme.com/static/js/embed.js";
    script.async = true;

    document.body.appendChild(script);

    return () => {
      document.body.removeChild(script);
    }
  }, []);

    
  return (
   <div>
     <div className="gfm-embed" data-url="https://www.gofundme.com/f/theyre-the-real-victims/widget/large/"></div>
   </div>
  )
};

export default Donation
about 4 years ago · Juan Pablo Isaza Relatório
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