From c3fce9f0ef1477c8e8cb1952e869bb59bd3fba39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Kram=C3=A1r?= Date: Mon, 16 Sep 2024 23:44:09 +0200 Subject: [PATCH] Add `onClick` support for the next.js `Link` component --- src/next.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/next.tsx b/src/next.tsx index 3e20e85..8d69a4e 100644 --- a/src/next.tsx +++ b/src/next.tsx @@ -29,6 +29,7 @@ export function Link({ children, replace, scroll, + onClick, ...rest }: Parameters[0]) { const router = useRouter(); @@ -38,6 +39,7 @@ export function Link({ { + onClick?.(e); if (isModifiedEvent(e)) return; e.preventDefault(); startTransition(() => {