Get User back immediately after LoginWithPopup in React

I need to register the user to my backend as soon as he/she authenticates to my React app.

Right now I am calling LoginWithPopup() for authentication. Immediately after this request, I want user credentials to make an API call for registering user. But as it turns out, I will have to wait for my component to re-render after login, to be able to access “user” from “useAuth0()” hook.

const { loginWithPopup, isAuthenticated, user } = useAuth0();
  const navigate = useNavigate();

  const loginHandler = async () => {
    try {
      await loginWithPopup();
      //register or fetch user from backend
      registerUserToBackend(user)  // need user here
      navigate("/dashboard");
    } catch (err) {
      logError(err);
    }
  };

How should I go about doing this?