Confused about helper hooks on react-moralis package

I saw there are a few beautiful hooks to use with react-moralis, But unfortunately, I can’t make them useful. I don’t understand how this should be used.

I’ve already wrapped it with the provider on my main index js file. As mentioned on docs, I would like to use useNativeBalance this hook/method. though I’ve already connected with MetaMask. But I get no data as output on a route. function Home() { const { getBalance, data: balance, nativeToken } = useNativeBalance({ chain: "eth" }); all the constants are showing undefined/null value.

I would like to know and understand what is the wrong thing I’m doing.

maybe this helps you: https://github.com/ethereum-boilerplate/ethereum-boilerplate#usenativebalance

Thank you so much

I should be more specific, I can’t use that hook useNativeBalance directly inside my component. I need to use it directly inside a component as how we do use other functional hooks like useState etc. When I’m using it that way, it’s not giving/loading any data to those return object.

Hey @mahbbrah

Please post full component code :muscle:

Hello @cryptokid ,

I use the hook useNativeBalance like mention it here : https://github.com/ethereum-boilerplate/ethereum-boilerplate#usenativebalance

but i have a problem when i refresh the page the balance become undefined !