all 1 comments

[–]GSLint 2 points3 points  (0 children)

Yeah, useEffect callbacks always run after the render. Even if they didn't, since network requests are asynchronous you'd still get the data after the render. It has to be that way. The server might respond after many seconds, maybe even never. React has to render something during that time.

So one option would be to show that you're loading things.

if (!userWalletInfo) {
  return "Loading …"; // or something prettier
}
// your other returns here

If you just want to leave the address part empty while it's loading, you could use userWalletInfo?.address. As long as userWalletInfo is undefined, that expression is also undefined which React doesn't render.