Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Using Material UI Sidebar #163

@haruki-nimbus

Description

@haruki-nimbus

This is a minor UI issue, but I created a sidebar with material-ui as below (this is a simplified verison):

import { MenuItem, SwipeableDrawer } from '@material-ui/core';
import { setLinkProps } from 'hookrouter';

const A = React.forwardRef(
  (props, ref) => <a ref={ref} {...setLinkProps(props)} />
);

// render
<SwipeableDrawer>
  {routes.map(route => (
    <MenuItem
       href={route.path}
       component={A}
       selected={/* route.path matches URL */}
       // other props
    >
      {route.title}
    </MenuItem>
  ))}
</SwipeableDrawer>

This works great, except the ripple effect on the MenuItem gets interrupted because the navigate function rerenders the sidebar. Any ideas on how to fix this?

I had the same setup when I was using import { Link } from 'react-router-dom', but that didn't interrupt the ripple animation when navigating from the sidebar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions