Skip to content

When returning null an empty breadcrumb is returned instead #78

Open
@InfiAest

Description

@InfiAest

Hi there 👋

I have stumbled across a problem where if you try to return null to the breadcrumb it renders an empty crumb instead of nothing.
Please see this codesandbox for an extremely basic example of the problem https://codesandbox.io/s/react-router-breadcrumbs-bug-infiaest-37wkbt?file=/index.tsx

As you can see in the codesandbox above I would like the breadcrumbs to display as Home / All Events when on the page with the pathname "/events" and then as Home / Event Name when on the child page with the pathname "/events/1".

I have used the function location.pathname === "/events" ? <span>All Events</span> : null which should return the desired breadcrumb. However returning null like this results in the breadcrumb containing an empty crumb like this: Home / / Event Name

Any help/fixes would be greatly appreciated! 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions