After I click logout on nextjs app it login again

Hello, can someone give me updated reference on how to solve this problem in NextJs

I have logout link to /api/auth/logout (Given that I setup the api/auth/[auth0]/route.js)

   <Button
            href="/api/auth/logout"
            variant="outlined"
            color="primary"
            component={Link}
            fullWidth
          >
            Logout
          </Button>

But when I clicked that there is an error on the console that I cannot clearly see because it reloads in split second and login again like nothing happens.

I am a noob developer so very sorry about this. Please help, if this was solved please comment down the references.

Thanks!

Solved temporarily by using onClick function instead of href. really weird.