Im having this problem i don’t know the problem
@cryptokid hi im back
hi, I don’t know the answer now
You need to use that useERC20Balances
line inside the Home function (before your return). You can read about React hooks.
Hi Glad,
I just did. Sorry I update to nativeBalance since BSC is native not erc20. and I’m getting null value
you could try to also use useState / useEffect hooks
Try to console log the data, sometimes the formatted is null but the data.balance has data.
if you use that data.balance instead of data.formatted in that return then it works?
I have experience what @suntay44 experience before and yes I can receive data.balance but data.formatted is null most of the time.
authentication messes it up, if I refresh the page the authentication doesn’t work for metamask
this issue with the authentication seems like a different issue?
what happens when it doesn’t work?
its not, I just noticed the useNativeBalance
only works when you don’t refreshed or when you loggedout and loggedIn again. Authentication of metamask messis it up that’s why it returns null for formatted.
Is there any way to check if current user isLoggedIn or not?
in the original code it looks like you hardcoded an address, in that case it should not matter if user is authenticated or not
it is possible to check if use is authenticated or not, or if web3 is enabled or not
you can find here some of the web hooks available for react-morals