yun*_*ver 6 javascript typescript reactjs htmlelements
我在 React 项目中使用打字稿,我想添加标签的道具。我可以访问元素的属性link,但不能访问属性a元素。link当标签的属性使用标签时,我收到错误a。
React 中的元素是否有“HTMLAElement”结构a?
const MyComponent: FunctionComponent<React.LinkHTMLAttributes<HTMLLinkElement>> = (
props: React.LinkHTMLAttributes<HTMLLinkElement>,
) => {
return (
<a {...props} className="mycomponent"> // When I use it with the <link> it doesn't give an error but I need <a>.
MyComponent
</a>
);
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10445 次 |
| 最近记录: |