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>
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.
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.
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.
you can now give the MenuItem
a component prop like this:
<MenuItem component={Link} to='/myRoute'>
go to my route
</MenuItem>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With