diff --git a/packages/react-router/src/client/components.tsx b/packages/react-router/src/client/components.tsx index ac0aebd..53d7a52 100644 --- a/packages/react-router/src/client/components.tsx +++ b/packages/react-router/src/client/components.tsx @@ -1,15 +1,21 @@ -import React from 'react' +import React, { forwardRef } from 'react' import { generatePath, Link, Navigate } from 'react-router-dom' import { LinkProps, To } from './types' +type LinkRef = React.ForwardedRef + export const components = >() => { return { - Link:

>({ to, params, ...props }: LinkProps) => { + Link: forwardRef(

>({ to, params, ...props }: LinkProps, ref: LinkRef) => { const path = generatePath(typeof to === 'string' ? to : to.pathname, params || ({} as any)) return ( - + ) - }, + }), Navigate:

>({ to, params, ...props }: LinkProps) => { const path = generatePath(typeof to === 'string' ? to : to.pathname, params || ({} as any)) return (