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

111
Vistas
React app stops working when trying to visualize changes in data

So I'm trying to update real time a balance and deposit (I'm developing a blockchain dapp) so I await the function in componentWillMount, but the website "crashes" (mouse locked) whenever I call this functions here. I'm guessing its not the way it's done, but where do I call it to stay updated real-time?

  async componentWillMount() {
    await this.balance()
    await this.viewDeposit()
  }

these are the functions, in case they are the problem

  //Balance 
  balance = async() => {
    const web3 = window.web3
    const balanceWei = await web3.eth.getBalance(this.state.account)
    const balance = web3.utils.fromWei(await balanceWei, 'ether') + ' ETH'
    this.setState({balance})
  }

  //Deposit
  viewDeposit = async() =>{
    const web3 = window.web3
    const depositWei = await web3.payments_contract.methods.viewFunds.call()
    const depositAmount = web3.utils.fromWei(await depositWei, 'ether') + 'ETH'
    this.setState({depositAmount})
  }

edit: the problem is with the viewDeposit function, when deleting it it works fine

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