import { useEffect, useState } from 'react'; import { Outlet, useLocation, useNavigate } from 'react-router-dom'; import routes from './routes'; export default function Header() { const location = useLocation(); const navigate = useNavigate(); const [currentPath, setCurrentPath] = useState(location.pathname); useEffect(() => { const name = routes.find((route) => route.path === currentPath)?.name; document.title = `React Flow Examples${name ? ' - ' + name : ''}`; navigate(currentPath); }, [currentPath]); return ( <>
React Flow Dev
); }