import React from 'react'; import { HashRouter, Link, Route, Routes, useLocation } from 'react-router-dom'; import { Alert, Breadcrumb } from 'antd'; const Apps = () => ( ); const breadcrumbNameMap: Record = { '/apps': 'Application List', '/apps/1': 'Application1', '/apps/2': 'Application2', '/apps/1/detail': 'Detail', '/apps/2/detail': 'Detail', }; const Home = () => { const location = useLocation(); const pathSnippets = location.pathname.split('/').filter((i) => i); const extraBreadcrumbItems = pathSnippets.map((_, index) => { const url = `/${pathSnippets.slice(0, index + 1).join('/')}`; return { key: url, title: {breadcrumbNameMap[url]}, }; }); const breadcrumbItems = [ { title: Home, key: 'home', }, ].concat(extraBreadcrumbItems); return (
Home Application List
} /> Home Page} />
); }; const App: React.FC = () => ( ); export default App;