[英]Where do I put my interface in the following function?
This is my Interface that I want to put in the props, but I dont know where to put it.这是我想放在道具中的界面,但我不知道放在哪里。
interface LinkTabProps {
label: string;
href: string;
};
This is the function.这就是功能。 I assume it should be put somehwere around (props: { label, href }).
我认为它应该放在某个地方(道具:{标签,href})。 But I cant figure out where.
但我不知道在哪里。
const LinkTab = (props: { label, href }) => (
<Tab
component="a"
onClick={(event) => event.preventDefault()}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
/>
);
This should do the trick(if it doesnt declare LinkTabProps as class):这应该可以解决问题(如果它没有将 LinkTabProps 声明为类):
const LinkTab = (props: LinkTabProps) => (
<Tab
component="a"
onClick={(event) => event.preventDefault()}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
/>
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.