import React from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; const BackButton: React.FC = () => { const navigate = useNavigate(); const location = useLocation(); if (location.pathname === "/") return null; const handleBack = () => { if (window.history.length > 2) window.history.back(); else navigate("/"); }; return ( ); }; export default BackButton;