如何在智能合约中完成 console.log 后显示结果

问题描述

    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 的新手,所以任何帮助都会很棒。谢谢!

解决方法

这是全部代码吗?你有像 onChange() 或 handleTask 方法吗?