Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do routing with material-ui@next MenuItem?

What's the best practice to implement routing using the material-ui@next? In the previous version I could use containerElement with a Link but doesn't work anymore. Couldn't find any help in the docs.

 <MenuItem containerElement={<Link to="/myRoute" />}>My Link</MenuItem>
like image 765
Bryan Stump Avatar asked Jan 26 '18 14:01

Bryan Stump


People also ask

What is nested route?

Nested Routes are a powerful feature. While most people think React Router only routes a user from page to page, it also allows one to exchange specific fragments of the view based on the current route.

What is react router?

React Router is a standard library for routing in React. It enables the navigation among views of various components in a React Application, allows changing the browser URL, and keeps the UI in sync with the URL.

How do I change the position of a material UI menu?

To position MenuItems under the React Material UI Select component, we can set the Select 's MenuProps component to set the position of the MenuItem s. We add the Select drop down with the MenuProps prop set to an object that has the anchorOrigin property to set the position of the menu.


1 Answers

you can now give the MenuItem a component prop like this:

<MenuItem component={Link} to='/myRoute'>
go to my route
</MenuItem>
like image 170
mrbenbot Avatar answered Sep 19 '22 07:09

mrbenbot