class AccountList extends React.Component { constructor(props) { super(props); this.state = { error: false, errorMessage: "", accounts: [] }; this.handleClick = this.handleClick.bind(this); this.handleCopyClick = this.handleCopyClick.bind(this); } async handleClick(e, updateAccountsCallback){ e.preventDefault(); try { updateAccountsCallback(); } catch(err) { this.setState({ error: true, errorMessage: e.name + ': ' + e.message }) } } handleCopyClick(e){ e.preventDefault(); var dummy = document.createElement("input"); document.body.appendChild(dummy); dummy.setAttribute('value', "await web3.eth.getAccounts();"); dummy.select(); document.execCommand("copy"); document.body.removeChild(dummy); } render(){ return {(context) => (

Get Accounts

await web3.eth.getAccounts();

accounts variable is available in the console

    { context.accounts.map((account, i) =>
  • {account}
  • ) }
)}
; } }