useNativeBalance returns correct amount of MATIC after authenticating with Metamask. The problem is that after the user is already authenticated and I refresh the page, the balance becomes undefined. I have the latest moralis and react-moralis.
import Container from 'react-bootstrap/Container';
import { useNativeBalance } from "react-moralis";
import ListGroup from 'react-bootstrap/ListGroup';
function Cryptocurrencies() {
const { data: balance } = useNativeBalance();
console.log(balance);
return (
<ListGroup as="ul">
<ListGroup.Item as="li" active>
{balance.formatted}
</ListGroup.Item>
</ListGroup>
);
}
export default Cryptocurrencies;