A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
GNU General Public License v3.0
5.56k
stars
1.53k
forks
source link
Provider in not defined after activating connector #579
Open
YVeselovskyi opened 2 years ago
hello!
I have metamask connector:
export const [metaMask, hooks] = initializeConnector((actions) => ( new MetaMask({ actions })));
and I use in in my component like this:
const provider = metaMaskHooks.useProvider(); const accounts = metaMaskHooks.useAccounts();
I want to create login functionality on button click, but provider and accounts are not defined there:
const onMetaMaskLogin = async () => { await metaMask.activate(); dispatch(loginWithMetamask(provider, accounts)); };
can I get them inside of this function somehow?
thank you!
P.S. I don't want to activate metaMask connector on component mount, just by clicking on button