'Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`SocialLogin`)

I am getting this warning in react: Warning: Cannot update a component (BrowserRouter) while rendering a different component (SocialLogin).

I went to the locations indicated in the stack trace and removed all setstates but the warning still persists. Is it possible this could occur from redux dispatch?

my partial code:

SocialLogin.js

const SocialLogin = () => {
      const [signInWithGoogle, googleUser, googleLoading, googleError] =
        useSignInWithGoogle(auth);

  return (
    <div>
      <div className=" d-flex justify-content-evenly ">
        <button
          onClick={() => signInWithGoogle()}
          type="submit"
          className="btn btn-outline-primary"
        >
          <img className="px-2" src={google} alt="" />
          Sign in with Google
        </button>
      </div>
    </div>
  );
};

export default SocialLogin;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source