EatTheBlocks Forum

MultisignWallet 10. Read smart contract data from the frontend with Web3

Hi there,

Iam in figure 6 course. Part 10. “Read smart contract data from the frontend with Web3”

I have this problem when i run npm start

WARNING in src\App.js
** Line 27:6: React Hook useEffect has missing dependencies: ‘setAccounts’, ‘setQuorum’, ‘setWallet’, and ‘setWeb3’. Either include them or remove the dependency array react-hooks/exhaustive-deps**

This is my app.js code:

import React, { useEffect, useState } from ‘react’;
import { getWeb3, getWallet} from ‘./utils.js’;
import Header from ‘./Header.js’;

function App() {

const [web3, setWeb3] = useState[undefined];
const [accounts, setAccounts] = useState[undefined];
const [wallet, setWallet] = useState[undefined];
const [approvers, setApprovers] = useState([]);
const [quorum, setQuorum] = useState[undefined];

useEffect( () => {
const init = async () => {
const web3 = getWeb3();
const accounts = await web3.eth.getAccounts();
const wallet = await getWallet(web3);
const approvers = await wallet.methods.getApprovers().call();
const quorum = await wallet.methods.quorum().call();
setWeb3(web3);
setAccounts(accounts);
setWallet(wallet);
setApprovers(approvers);
setQuorum(quorum);
}
init();
}, [] )

if(typeof web3 === ‘undefined’ || accounts === ‘undefined’ || wallet === ‘undefined’ || approvers.length === 0 || quorum === ‘undefined’)
{
return

Loading…

}

return (


Multisign App


);
}

export default App;