Answer the question
In order to leave comments, you need to log in
How is a tag typed in React on typescropt?
Good day.
The HTMLLinkElement type contains href: string but when destructuring the props it says:
Property "href" does not exist in the type "ILinkProps & { children?: ReactNode; }".ts(2339)
Tell me where is it wrong?
Thanks
interface ILinkProps
extends DetailedHTMLProps<HTMLAttributes<HTMLLinkElement>, HTMLLinkElement> {
cursorPointer?: boolean;
}
export const Link: React.FC<ILinkProps> = (props): JSX.Element => {
const { innerElement, cursorPointer = false, children, href } = props;
return <a>{children}</a>
);
};
interface HTMLLinkElement extends HTMLElement, LinkStyle {
as: string;
/**
* Sets or retrieves the character set used to encode the object.
*/
/** @deprecated */
charset: string;
crossOrigin: string | null;
disabled: boolean;
/**
* Sets or retrieves a destination URL or an anchor point.
*/
href: string;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question