Material UI Menu using routes

前端 未结 12 931
悲哀的现实
悲哀的现实 2020-12-17 08:59

I am toying with material-ui. I implemented LeftNav using routes, but I could not find a way to get IconMenu, or Menu working with links or routes. Anyone can point me to a

12条回答
  •  借酒劲吻你
    2020-12-17 09:33

    You can use react-route-dom and MenuItem onClick attribute first import react-router-dom: import { useHistory } from 'react-router-dom' then declare a function to handle your onClick within your component: const navigate = () => history.push('route/to/navigate') and then user your MenuItem Navigate

提交回复
热议问题