icd2k3/react-router-breadcrumbs-hoc

What to use instead of InjectedProps

Closed this issue · 3 comments

The last version saw the TS definition for InjectedProps get removed. What are we meant to use instead?

Any idea how this can be fixed?
Breadcrumbs assume a React.ReactNode[] but with no further type definition of breadcrumbs.

Any help?

Hello @abemedia @asherccohen 👋 . I switched from manually defining types to having them generated for the package (when I switched the src code from js to ts, this is probably when we switched off of InjectedProps). The current definition for a breadcrumbs route is:

export interface BreadcrumbsRoute {
    path: string;
    breadcrumb?: React.ComponentType | React.ElementType | string;
    matchOptions?: MatchOptions;
    routes?: BreadcrumbsRoute[];
}

Where breadcrumb is an optional component/element/string.

Is this missing something? Let me know and I'm happy to adjust or accept a PR!

oh, is this related to being able to pass extra props as part of the route object?

routes = [{
  path: '/path',
  breadcrumb: ({ extra }) => <span>{extra}</span>,
  extra: 'extra',
}]