Skip to content

The Menu auto-close behaviour when wrapping a Link #2942

Closed Answered by jarimustonen
jarimustonen asked this question in Help
Discussion options

You must be logged in to vote

I managed to resolve this myself. We need to pass the rest of the parameters to the link component:

const MyLink = forwardRef(
    function MyLink({ children, to, ...restProps }: MyLinkProps, ref: React.ForwardedRef<HTMLAnchorElement>) {
        return (
            <Link to={to} ref={ref} { ...restProps }>
                {children}
            </Link>
        );
    }
);

I'm leaving the thread here, in case the powers that be deems this to be worth leaving. Otherwise, please remove this.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jarimustonen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant