Skip to content

Commit

Permalink
Merge pull request #26 from PiwikPRO/fix/navigation-link
Browse files Browse the repository at this point in the history
fix(example): use Link component from react router instead of default one
  • Loading branch information
auto200 authored Jan 29, 2024
2 parents e268d2d + bfcac91 commit f9a8326
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion example/src/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import {
ListItemButton,
ListItemText
} from '@mui/material'
import { Link, useLocation } from 'react-router-dom'

const drawerWidth: number = 270

function Header() {
const { pathname } = useLocation()

return (
<Drawer
variant='permanent'
Expand All @@ -26,7 +29,11 @@ function Header() {
<List>
{routes.map(({ path, name }, index) => (
<ListItem key={index} disablePadding>
<ListItemButton component='a' href={path}>
<ListItemButton
component={Link}
to={path}
selected={pathname === path}
>
<ListItemText primary={name} />
</ListItemButton>
</ListItem>
Expand Down

0 comments on commit f9a8326

Please sign in to comment.