您的功能请求是否与问题相关?请描述
如果我有如下的代码:
import { Link } from 'react-router-dom';
import MyLinkComponent from '.';
export const WithReactRouter: Story = (args) => <MyLinkComponent as={Link} />
在“显示代码”下生成的代码看起来像这样:
<MyLinkComponent
as={{
$$typeof: Symbol(react.forward_ref),
displayName: 'Link',
propTypes: {
innerRef: () => {},
onClick: function noRefCheck() {},
replace: function noRefCheck() {},
target: function noRefCheck() {},
to: function noRefCheck() {}
},
render: function noRefCheck() {}
}}
/>
描述您希望的解决方案
对于属性是React组件类型的情况,请在示例代码中使用组件的 displayName
:
<MyLinkComponent
as={Link}
/>
您是否能够协助将功能变为现实?
如果得到一些支持和指导,我本周可能有一些时间!否则,从下周开始会很忙一段时间。
1条答案
按热度按时间kxeu7u2r1#
看起来像是重复的问题 #16995 ?