I wrote a private router. It works correctly with props but doesn't redirect when props are wrong. Could you help me with this issue? Here is a snippet of my code:
export function PrivateRoute({ children, ...rest }) {
const navigate = useNavigate();
const { props } = rest;
return (
<Routes>
<Route
{...rest}
render={() => (props === 'admin' ? children : navigate(url))}
/>
</Routes>
);
}