Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!