Redirect to a dynamic url address after logout?

I use @auth0/auth0-react v2.2.4. The app I’m building has dynamic pages that have various entity IDs in the URL. It means I cannot have them listed as Allowed Logout URLs.

After a user logs out, I want to show them the login page with the ?redirectTo= value equal to the address they log out from. So when they log in again, they will see the page they were logged out from.

How do I achieve that?