xXConnorXx-095 / Nextjs-smartcontract-lottery-fcc

0 stars 0 forks source link

Moralis and React problem #1

Open xXConnorXx-095 opened 1 year ago

xXConnorXx-095 commented 1 year ago

In the file components/LotteryEntrance.js in the useMoralis idk why the chain id when i am printing it returns NaN const { chainId: chainIdHex, isWeb3Enabled } = useMoralis() const chainId = parseInt(chainIdHex) which leads that the raffleAddress will return to nullconst raffleAddress = chainId in contractAddresses ? contractAddresses[chainId][0] : null ...And idk why the useEffect is not running on the first render cause it is not printing "Hello" which leads to not calling the updateUI functionuseEffect(() => { console.log("HEllo") if (isWeb3Enabled) { updateUI() } }, [isWeb3Enabled]). I need help pls!

xXConnorXx-095 commented 1 year ago

I am following this tutorial btw https://www.youtube.com/watch?v=gyMwXuJrbJQ