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

205
Vistas
Is the parent div element clicked with React

Any ideas on how can I trigger whether the user has clicked the parent element, but don't react to the click, if the user clicked inside the child div using ReactJS. As on the screenshot, I wish to "do something" if the user clicked in the black area, but don't react to clicks inside the white box

enter image description here

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

0

Put an onClick on the child div and have it stop propagation:

const Example = () => {
  return (
    <div onClick={(e) => {
       // Handle the click for the outer area
    }}>
      <div onClick={(e) => e.stopPropagation()}>

      </div>
    </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