If someone reason prefers the hard-coded version from whatever reason:
const loadBlockchainData = async () => {
const web3 = window.web3
const networkId = await web3.eth.net.getId()
if (networkId !== 4) {
window.alert('Please switch network to the Rinkeby and refresh the page')
}
const contract_address = '0x32F46b5fdd6bEb553E2C1Df2E17400D208da2359';
const deployedContract = new web3.eth.Contract(Game.abi, contract_address);
setGameContract(deployedContract);
const accounts = await web3.eth.getAccounts();
setAccount(accounts[0])
const bal = await web3.eth.getBalance(accounts[0]);
setBalance(bal);
deployedContract.methods.name().call(function (err, res) {
setName(res)
});
}
