【问题标题】:How the `component` property works with Tab component?`component` 属性如何与 Tab 组件一起使用?
【发布时间】:2020-08-15 17:48:46
【问题描述】:

我试图通过单击 <Tab/> 组件来更改 URL 路径,我通过 Material-UI Tab API 搜索它但找不到任何东西。然后我遇到了solution

 <Tab label='Most popular ideas'  to='/myPath' component={Link} />

问题是如何使用component 属性,即使它不是&lt;Tab/&gt; 的道具之一,它是如何工作的?

【问题讨论】:

    标签: reactjs material-ui react-router-dom


    【解决方案1】:

    查看文档:

    提供的任何其他属性都将提供给根元素 (ButtonBase)。

    这是 ButtonBase 的 API 道具: https://v4-0-2.material-ui.com/api/button-base/

    您将提供给 Tab 元素的道具,该元素未使用该道具将冒泡到下一个组件,在这种情况下,ButtonBase 使用您的 component 道具。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-16
      • 1970-01-01
      • 2021-11-27
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多