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

116
Vistas
Render HTML of embed-deployed Component

I want to integrate my react app to a 3rd party app which enables me to put a script that appends the elements into the html.

But it appears that it is not that straightforward in react. The script does not append the elements so my custom component does not appear on the page.

This is what I am trying to do ( but not a gist ):

function Snippet){
    
    return (
        <Wrapper>
            <h1> Snippet 1</h1>
            <script src="https://gist.github.com/xxxx/e4208e452e32e353b6076944c80a1058.js"></script>
        </Wrapper>
    )
}

Is there a way to do this with just react?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hi Going back to this inquiry, I found an npm package that enables the embedding of github gist in a react component.

Following the implementation of the Gist Component in the package, we can also deploy the code programmatically instead of pasting the deployment script directly to the component and it will work just fine.

export default class DeployedComponent extends React.Component{
constructor(props){
    super(props);
}

componentDidMount(){
    (function(props,doc,elementName,id){
        let jsElement;
        if(doc.getElementById(id)){
            return;
        }
        jsElement = doc.createElement(elementName);
        jsElement.id = id;
        jsElement.src= "deployment_script_src";
        doc.getElementsByClassName("cb-deployment-wrapper")[0].appendChild(jsElement);


    })(this.props, document,"script","script_id");
}


render(){
    return (
        <div className="w-100 cb-deployment-wrapper ">
        </div>
    );
}
}
about 4 years ago · Juan Pablo Isaza Denunciar
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