import { ArrowLeft } from 'lucide-react'; import { useLocation, useNavigate } from 'react-router-dom'; type BackButtonProps = { fallbackTo: string; label?: string; }; const BackButton = ({ fallbackTo, label = 'Voltar' }: BackButtonProps) => { const navigate = useNavigate(); const location = useLocation(); const handleClick = () => { if (location.key !== 'default' && window.history.length > 1) { navigate(-1); return; } navigate(fallbackTo, { replace: true }); }; return ( ); }; export default BackButton;