From 2d62dc38c0961be95e6f0ebea3568afceae88270 Mon Sep 17 00:00:00 2001 From: Rastraponovich Date: Tue, 18 Jun 2024 09:48:27 +0300 Subject: [PATCH] Allow to pass replace param to Link component --- src/link.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/link.tsx b/src/link.tsx index c5060ef..9db51a1 100644 --- a/src/link.tsx +++ b/src/link.tsx @@ -8,6 +8,7 @@ import { useRouter } from "./router-provider"; export type LinkProps = { to: RouteInstance | string; params?: Params; + replace?: boolean; query?: RouteQuery; className?: string; activeClassName?: string; @@ -18,7 +19,7 @@ const LinkView = ( props: LinkProps, ref: ForwardedRef, ) => { - const { to, params, query, activeClassName, inactiveClassName, ...linkProps } = props; + const { to, params, query, activeClassName, inactiveClassName, replace, ...linkProps } = props; if (typeof props.to === "string") { return ( @@ -48,6 +49,7 @@ const RouteLinkView = ( onClick, children, target, + replace, ...linkProps } = props; @@ -97,6 +99,7 @@ const RouteLinkView = ( navigate({ params: params || ({} as Params), query: query || {}, + replace, }); }} >