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

128
Views
How to render a variable from a function

So I'm trying to render a constructor variable but when I add the lines that renders it, the whole page goes blank. I don't know if it's that this.balance() is not called there or sm. I'm new so help is appreciated :)

  constructor(props){
    super(props)
    this.state = {
      balance: ""
    }
  }

  balance = async() => {
    const web3 = window.web3
    const balance = web3.eth.getBalance(this.state.account)
    this.setState({balance})
  }

render(){
    this.balance()
    return(
      <section id="payments">
        Payments
        <Nav/>
        <p>balance: {this.state.balance}</p>
      </section>
    )
  } 
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!