import React from 'react'; import { useLocation, Link, useMatches } from 'react-router-dom'; import { theme } from 'antd'; import { RightOutlined } from '@ant-design/icons'; export default function Breadcrumb() { let matches = useMatches(); const { token } = theme.useToken() let crumbs = matches // first get rid of any matches that don't have handle and crumb .filter((match) => Boolean((match.handle as any)?.crumb)) // now map them into an array of elements, passing the loader // data to each one .map((match) => (match.handle as any).crumb(match.data)); return (
    {crumbs.map((crumb, index) => (
  1. {crumb}
  2. {index < crumbs.length - 1 && (
  3. )}
    ))}
); }