I have a component
<SecondaryItem
type="dropdown"
linkData={[
{ text: "О Вконтакте", url: "./" },
{ text: "Вакансии", url: "./" },
{ text: "Правовая информация", url: "./" },
{ text: "Защита данных", url: "./" },
{ text: "Центр безопасности", url: "./" },
{ text: "Помощь", url: "./" },
{ text: "Язык: русский", url: "./" },
]}
/>
But when I try to add types to it's props, it throws an error
interface Props {
className?: string;
type: "link" | "dropdown";
linkData: { text: string; url: string }[];
}
export const SecondaryItem: React.FC<Props> = (props: Props): JSX.Element => {
return (
<li className={cn("secondary-item", props.className)}>
<a className="secondary-item__link" href={props.linkData.url}>
{props.linkData.text}
</a>
</li>
);
};
How can I solve it ?
