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

182
Vistas
Accessing HTML element through React and adding onClick effect

I have a React application, which uses GraphQL to fetch data from backend. Requested data is a html code (content with some divs) built with CMS page editor and rendered using React.

HTML code is rendered using https://www.npmjs.com/package/html-react-parser

How can I access <button class="someClass">SUBSCRIBE</button> through different react component ? The reason I want to access it through react is that I have a Newsletter module which is responsible for making GQL requests and validating recaptcha, as well as Popup module. The popup should be displayed when we hit SUBSCRIBE - this is why I want to attach onClick to that button.

Should I use document.getElementsByClassName in componentDidMount ? Or is there a better way to achieve things like this ?

Newsletter box

about 4 years ago · Juan Pablo Isaza
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