简体   繁体   English

Material-ui添加来自react-router的Radio Button组件的链接

[英]Material-ui adding Link to Radio Button component from react-router

Hellou! Hellou! I have 2 radiobuttons and I want to add a link. 我有2个radiobuttons,我想添加一个链接。 I tried to do it the way: 我试着这样做:

    <RadioButton
      value="/searchByArtistAndName"
      label="Artist and Name"
      style={styles.radioButton}
      containerElement={<Link to="/searchByArtistAndName"/>}
    />

But containerElement is not defined for RadioButton. 但是没有为RadioButton定义containerElement。 Any idea? 任何的想法?

You can put any react component in the label property, not just a text string. 您可以将任何react组件放在label属性中,而不仅仅是文本字符串。

<RadioButton
  label={<Link to="/your_route" />}
  ...
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM