【问题标题】:How to display results after console.log is complete from smart contract如何在智能合约完成 console.log 后显示结果
【发布时间】:2021-08-25 15:46:36
【问题描述】:
    const init = async()=>{

      console.log("waiting for Fill1 method to complete");
      const result1 = await contract.methods.Fill1("Mathematics", "77", "Physics", "80", "Chemistry", "30").send({from accounts[0]});
      console.log("Fill1 completed);
      console.log("Events from Fill1);
      console.log(result1.events);
}
return (
<button onClick = {init} type "button">Display Information</button>
);

上面的代码将智能合约中的信息正确地呈现到控制台上,但我现在找不到使用 react 在 UI 中显示它的方法。我不知道我是否应该使用React.render() 或者是否有其他方式。我是 React 的新手,所以任何帮助都会很棒。谢谢!

【问题讨论】:

    标签: html reactjs user-interface smartcontracts


    【解决方案1】:

    这就是所有的代码吗?你有喜欢 onChange() 或 handleTask 方法吗?

    【讨论】:

    • 这是所有代码。我没有 handleTask 或 onChange 方法
    • link to examples 我发现这个 repo 有很好的例子,应该能够解决你的问题
    猜你喜欢
    • 2021-05-29
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-08
    相关资源
    最近更新 更多