使用material-ui@next
?实现路由的最佳实践是什么?在以前的版本中,我可以使用containerElement
aLink
但不再工作了。在文档中找不到任何帮助。
<MenuItem containerElement={<Link to="/myRoute" />}>My Link</MenuItem>
使用material-ui@next
?实现路由的最佳实践是什么?在以前的版本中,我可以使用containerElement
aLink
但不再工作了。在文档中找不到任何帮助。
<MenuItem containerElement={<Link to="/myRoute" />}>My Link</MenuItem>
你现在可以MenuItem
像这样给一个组件props:
<MenuItem component={Link} to='/myRoute'>
go to my route
</MenuItem>
您可以Link
用作父组件MenuItem
:
<MenuList>
<Link to="/myRoute" style={{ textDecoration: 'none', display: 'block' }}>
<MenuItem>
go to my route
</MenuItem>
</Link>
<Link to="/anotherRoute" style={{ textDecoration: 'none', display: 'block' }}>
<MenuItem>
go to another route
</MenuItem>
</Link>
</MenuList>