From f734918d3e56b9e3dafa0ebea2770a736dcd647f Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 8 Apr 2020 09:47:23 -0400 Subject: [PATCH] Removes withRouter from breadcrumbs in favor of hooks --- .../src/components/Breadcrumbs/Breadcrumbs.jsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/awx/ui_next/src/components/Breadcrumbs/Breadcrumbs.jsx b/awx/ui_next/src/components/Breadcrumbs/Breadcrumbs.jsx index fade4ce046..670a4d01a3 100644 --- a/awx/ui_next/src/components/Breadcrumbs/Breadcrumbs.jsx +++ b/awx/ui_next/src/components/Breadcrumbs/Breadcrumbs.jsx @@ -7,7 +7,7 @@ import { BreadcrumbItem, BreadcrumbHeading, } from '@patternfly/react-core'; -import { Link, Route, withRouter, useRouteMatch } from 'react-router-dom'; +import { Link, Route, useRouteMatch } from 'react-router-dom'; import styled from 'styled-components'; @@ -16,21 +16,22 @@ const PageSection = styled(PFPageSection)` padding-bottom: 10px; `; -const Breadcrumbs = ({ breadcrumbConfig, match }) => { +const Breadcrumbs = ({ breadcrumbConfig }) => { const { light } = PageSectionVariants; return ( - + ); }; -const Crumb = ({ breadcrumbConfig, match }) => { +const Crumb = ({ breadcrumbConfig }) => { + const match = useRouteMatch(); const crumb = breadcrumbConfig[match.url]; let crumbElement = ( @@ -49,16 +50,11 @@ const Crumb = ({ breadcrumbConfig, match }) => { crumbElement = null; } - function NextCrumb() { - const routeMatch = useRouteMatch(); - return ; - } - return ( {crumbElement} - + ); @@ -72,4 +68,4 @@ Crumb.propTypes = { breadcrumbConfig: PropTypes.objectOf(PropTypes.string).isRequired, }; -export default withRouter(Breadcrumbs); +export default Breadcrumbs;