I have a private route component that needs to redirect to different page if the user is not authorized. for some reason the redirect from \'react router dom\' does not work