A bit issue with Moralis Auth

Whenever a user switches/connects his/her new wallet address. Moralis auth pops up 4 times!

Screenshot 2021-10-11 at 11.33.46 PM|467x85

sometimes it pops up 34 times
Screenshot 2021-10-11 at 11.35.29 PM

props.Moralis.onAccountsChanged(async function (accounts) {
          await props.authenticate();

I have a doubt that it’s because of this function

I heard that useEffect can solve similar problems

how to do that?

^ this one was mentioned in the docs