How to add a link to a List in material-ui 1.0?

前端 未结 2 923
情话喂你
情话喂你 2021-01-03 17:51

The following messes with the onClick animation (the ListItem turns red):


  
    

        
2条回答
  •  攒了一身酷
    2021-01-03 18:30

    The easiest way to accomplish this is to make the ListItem a link by using the component prop:

    
      
        
      
    
    

    That way, the ListItem will be an anchor tag linking to the desired place, but still receive the appropriate styling so that there won't be any visual changes.

    The behavior of the component prop is documented here. Note that the href prop will be automatically passed to the anchor tag, as specified by the last line in the props documentation:

    Any other properties supplied will be spread to the root element.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题