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

203
Vistas
How to append to the div in babeljs

Using this always updates the html but doesn't append to it.

function App(props) {
  return (
    <div>
      hello
    </div>
  );
}

const root = ReactDOM.createRoot(document.getElementById("emails-view-content"));
for (let i = 0; i < 3; i++) {
  
  root.render(<App/>);
}

I want to write hello 3 times instaed of just one.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

App should be the component that adds the "hello" statements to the HTML.

How you do that is entirely up to you but here's a simple example. It uses a separate <Hello> component. App receives a number in its props which it uses to create an array of <Hello> components which are then rendered.

function App({ number }) {

  function buildHellos(n) {
    return new Array(n).fill(<Hello />);
  }

  return (
    <div>{buildHellos(+number)}</div>
  );

}

function Hello() {
  return <p>Hello</p>;
}

ReactDOM.render(
  <App number="3" />,
  document.getElementById('react')
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script>
<div id="react"></div>

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