- Add jscodeshift-based codemod to convert arrow function components to function declarations - Support React.FC, observer-wrapped, and forwardRef components - Include comprehensive test suite covering edge cases - Add npm script to run transformer across codebase - Target only .tsx files in source directories, excluding node_modules and declaration files * [WEB-5459] chore: updates after running codemod --------- Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
18 lines
587 B
TypeScript
18 lines
587 B
TypeScript
"use client";
|
|
import React from "react";
|
|
import { Link as RRLink } from "react-router";
|
|
import { ensureTrailingSlash } from "./helper";
|
|
|
|
type NextLinkProps = React.ComponentProps<"a"> & {
|
|
href: string;
|
|
replace?: boolean;
|
|
prefetch?: boolean; // next.js prop, ignored
|
|
scroll?: boolean; // next.js prop, ignored
|
|
shallow?: boolean; // next.js prop, ignored
|
|
};
|
|
|
|
function Link({ href, replace, prefetch: _prefetch, scroll: _scroll, shallow: _shallow, ...rest }: NextLinkProps) {
|
|
return <RRLink to={ensureTrailingSlash(href)} replace={replace} {...rest} />;
|
|
}
|
|
|
|
export default Link;
|