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

265
Vistas
How to change displayed text in react component?

I installed react-mailchimp-subscribe and I want to change text button because my website is not written in English. i putted this component into div className="pokemon" to have access to him like .pokemon > div > button and could have change styles. Now I want to change text. I try to acces to him by using

useEffect(() = > {
document.addEventListener("load", function(){
(".pokemon>div>button").innerHtml("Wyślij")
}); }, [])

but I guess in my function is too many errors that it actually work.

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

0

You can update the button label using the state. Please refer the below code

import React, { useEffect, useState } from 'react'

export default function App() {
  const [buttonLabel, setButtonLabel ] = useState("I'm Button");

  useEffect(() => {
    setButtonLabel("Wyślij")
  }, [])

  return (
      <div className="pokemon">
      <div>
        <button> {buttonLabel}</button>
      </div>
    </div>
    )
}

Here is the link to codesandbox environment

about 4 years ago · Juan Pablo Isaza Denunciar

0

If you want to do it using dom, you can use the below code.

You have some minor syntax mistake.

useEffect(() = > {
document.addEventListener("load", function(){
document.querySelector(".pokemon").querySelector("div").querySelector("button").innerHTML = "Wyślij";
}); }, [])
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