State.init({ accountId: "", loading: false, score_result: null, }); const contract = "v1.nadabot.near"; function getScore() { Near.asyncView(contract, "get_human_score", { account_id: state.accountId, }).then((result) => { console.log("result", result); State.update({ score_result: result }); }); } return ( <div> <input placeholder="Enter Account Id" value={state.accountId} onChange={(e) => State.update({ accountId: e.target.value })} /> {state.score_result && <span>Score is {state.score_result.score}</span>} <div> <button onClick={getScore} style={{ marginTop: 10 }}> Get score </button> </div> </div> );