From f260328900da71141b2fc94b4e098cffee5ff204 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Tue, 18 Oct 2022 03:20:28 +0200 Subject: [PATCH 001/300] BREAKING CHANGE: Enable newNextLinkBehavior (#41459) - Enable newNextLinkBehavior. See #36436 - Run next/link codemod on test suite Note that from when this lands on apps trying canary will need to run the new-link codemod in order to upgrade. Ideally we have to detect `` while rendering the new link and warn for it. Co-authored-by: Steven --- docs/advanced-features/codemods.md | 24 +++ docs/advanced-features/i18n-routing.md | 4 +- docs/api-reference/next.config.js/basepath.md | 4 +- docs/api-reference/next/link.md | 46 +++-- docs/api-reference/next/router.md | 6 +- docs/migrating/from-gatsby.md | 8 +- docs/migrating/from-react-router.md | 2 +- docs/routing/dynamic-routes.md | 10 +- docs/routing/introduction.md | 16 +- docs/testing.md | 8 +- docs/upgrading.md | 2 + packages/next/build/jest/jest.ts | 2 +- packages/next/server/config-shared.ts | 3 +- .../basic-basepath/hmr/pages/hmr/index.js | 4 +- .../misc/pages/development-logs/index.js | 2 +- .../development-logs/link-with-no-prefetch.js | 4 +- .../link-with-prefetch-false.js | 2 +- .../next-dynamic/pages/dynamic/index.js | 4 +- test/development/basic/hmr/pages/hmr/index.js | 4 +- .../misc/pages/development-logs/index.js | 2 +- .../development-logs/link-with-no-prefetch.js | 4 +- .../link-with-prefetch-false.js | 2 +- .../basic/next-dynamic/pages/dynamic/index.js | 4 +- test/e2e/app-dir/app-prefetch/app/page.js | 4 +- .../app-static/app/blog/[author]/page.js | 28 +-- .../app/dynamic-no-gen-params/[slug]/page.js | 8 +- .../app-dir/app/app/catch-all-link/page.js | 11 +- test/e2e/app-dir/app/app/internal/page.js | 8 +- .../app/app/link-hard-push/[id]/page.js | 4 +- .../app/app/link-hard-replace/[id]/page.js | 4 +- .../app-dir/app/app/link-hard-replace/page.js | 8 +- .../app/app/link-hard-replace/subpage/page.js | 4 +- .../app-dir/app/app/link-soft-push/page.js | 4 +- .../app-dir/app/app/link-soft-replace/page.js | 8 +- .../app/app/link-soft-replace/subpage/page.js | 4 +- test/e2e/app-dir/app/app/link-with-as/page.js | 3 +- .../app/app/nested-navigation/TabNavItem.js | 4 +- .../e2e/app-dir/app/app/pages-linking/page.js | 4 +- .../app/redirect/next-config-redirect/page.js | 4 +- .../redirect/next-middleware-redirect/page.js | 4 +- test/e2e/app-dir/app/app/rewrites/page.js | 4 +- .../app-dir/app/app/same-layout/first/page.js | 4 +- .../app/app/same-layout/second/page.js | 4 +- .../template/clientcomponent/other/page.js | 4 +- .../app/app/template/clientcomponent/page.js | 4 +- .../template/servercomponent/other/page.js | 4 +- .../app/app/template/servercomponent/page.js | 4 +- test/e2e/app-dir/app/app/with-id/page.js | 4 +- test/e2e/app-dir/app/pages/app-linking.js | 4 +- .../app/pages/link-to-rewritten-path.js | 4 +- test/e2e/app-dir/asset-prefix/app/page.js | 4 +- .../rsc-basic/app/next-api/link/page.js | 4 +- test/e2e/app-dir/rsc-basic/components/nav.js | 12 +- test/e2e/app-dir/trailingslash/app/page.js | 4 +- .../basepath/pages/absolute-url-basepath.js | 11 +- .../pages/absolute-url-no-basepath.js | 7 +- test/e2e/basepath/pages/absolute-url.js | 8 +- test/e2e/basepath/pages/hello.js | 72 +++----- test/e2e/basepath/pages/index.js | 4 +- .../basepath/pages/invalid-manual-basepath.js | 6 +- test/e2e/basepath/pages/link-to-root.js | 4 +- .../dynamic-route-interpolation/index.test.ts | 4 +- .../app/pages/another/index.js | 8 +- .../app/pages/blog/[post]/[comment].js | 4 +- .../app/pages/blog/[post]/index.js | 4 +- .../app/pages/blog/index.js | 4 +- .../app/pages/catchall/[...path].js | 8 +- .../app/pages/default-revalidate.js | 8 +- .../e2e/getserversideprops/app/pages/index.js | 40 +++-- .../app/pages/invalid-keys.js | 8 +- .../app/pages/not-found/[slug].js | 4 +- .../app/pages/not-found/index.js | 4 +- .../app/pages/slow/index.js | 8 +- .../getserversideprops/app/pages/something.js | 8 +- .../app/pages/user/[user]/profile.js | 4 +- .../app/pages/index.js | 46 ++--- .../link-with-api-rewrite/app/pages/index.js | 8 +- .../app/pages/another.js | 8 +- .../app/pages/dynamic/[slug].js | 8 +- .../app/pages/index.js | 8 +- .../middleware-base-path/app/pages/index.js | 29 ++-- .../app/pages/routes.js | 4 +- .../app/pages/routes.js | 16 +- .../app/pages/routes.js | 8 +- .../e2e/middleware-general/app/pages/error.js | 4 +- .../middleware-general/app/pages/shallow.js | 8 +- .../app/pages/another-middleware.js | 4 +- .../app/pages/blog/[slug].js | 8 +- .../e2e/middleware-matcher/app/pages/index.js | 8 +- .../middleware-redirects/app/pages/index.js | 38 ++-- .../middleware-responses/app/pages/index.js | 48 ++---- .../app/pages/fallback-true-blog/[slug].js | 12 +- .../e2e/middleware-rewrites/app/pages/i18n.js | 20 +-- .../middleware-rewrites/app/pages/index.js | 54 +++--- .../app/pages/error.js | 4 +- .../app/pages/shallow.js | 8 +- test/e2e/new-link-behavior/app/next.config.js | 6 +- .../material-ui/next.config.js | 3 - .../new-link-behavior/stitches/next.config.js | 3 - .../typescript/next.config.js | 3 - .../components/roboto-comp.js | 4 +- .../pages/inter.js | 4 +- test/e2e/prerender/pages/another/index.js | 8 +- .../pages/blocking-fallback-once/[slug].js | 4 +- .../pages/blocking-fallback-some/[slug].js | 4 +- .../pages/blocking-fallback/[slug].js | 4 +- .../prerender/pages/blog/[post]/[comment].js | 4 +- test/e2e/prerender/pages/blog/[post]/index.js | 4 +- test/e2e/prerender/pages/blog/index.js | 4 +- .../pages/catchall-explicit/[...slug].js | 4 +- .../pages/catchall-optional/[[...slug]].js | 4 +- .../e2e/prerender/pages/default-revalidate.js | 8 +- test/e2e/prerender/pages/dynamic/[slug].js | 4 +- .../prerender/pages/fallback-only/[slug].js | 4 +- test/e2e/prerender/pages/index.js | 87 ++++++---- test/e2e/prerender/pages/large-page-data.js | 8 +- test/e2e/prerender/pages/something.js | 8 +- .../prerender/pages/user/[user]/profile.js | 4 +- .../pages/[id].js | 21 ++- .../app/pages/another.js | 4 +- .../app/pages/blog/[slug].js | 4 +- .../app/pages/index.js | 8 +- .../streaming-ssr/pages/hello.js | 4 +- test/e2e/switchable-runtime/pages/node.js | 24 +-- test/e2e/type-module-interop/index.test.ts | 8 +- .../absolute-assetprefix/pages/index.js | 24 ++- test/integration/amphtml/pages/nav.js | 8 +- test/integration/amphtml/pages/normal.js | 4 +- test/integration/app-document/pages/about.js | 4 +- test/integration/app-document/pages/index.js | 4 +- test/integration/app-tree/pages/_app.tsx | 4 +- .../basepath-root-catch-all/pages/hello.js | 4 +- .../build-indicator/pages/index.js | 8 +- test/integration/chunking/pages/page3.js | 4 +- test/integration/client-404/pages/_error.js | 4 +- .../client-404/pages/invalid-link.js | 8 +- .../client-404/pages/to-missing-link.js | 4 +- .../client-navigation-a11y/pages/index.js | 22 +-- .../client-navigation/pages/absolute-url.js | 37 ++-- .../pages/link-invalid-onclick.js | 2 +- .../client-navigation/pages/link-no-child.js | 2 +- .../pages/link-number-child.js | 5 +- .../client-navigation/pages/link.js | 5 +- .../client-navigation/pages/nav/about.js | 4 +- .../pages/nav/as-path-pushstate.js | 18 +- .../pages/nav/as-path-query.js | 6 +- .../pages/nav/hash-changes.js | 38 ++-- .../client-navigation/pages/nav/head-1.js | 8 +- .../client-navigation/pages/nav/head-2.js | 4 +- .../client-navigation/pages/nav/head-3.js | 4 +- .../client-navigation/pages/nav/index.js | 118 +++++++------ .../pages/nav/long-page-to-snap-scroll.js | 8 +- .../client-navigation/pages/nav/on-click.js | 33 ++-- .../pages/nav/pass-href-prop.js | 4 +- .../client-navigation/pages/nav/query-only.js | 4 +- .../pages/nav/querystring.js | 11 +- .../client-navigation/pages/nav/relative-1.js | 5 +- .../pages/nav/self-reload.js | 4 +- .../pages/nav/shallow-routing.js | 6 +- .../client-shallow-routing/pages/[slug].js | 12 +- .../test/index.test.js | 20 +-- .../composes-ordering/pages/index.js | 4 +- .../composes-ordering/pages/other.js | 4 +- .../csp-style-src-nonce/pages/index.js | 4 +- .../csp-style-src-nonce/pages/other.js | 4 +- .../hydrate-without-deps/pages/index.js | 4 +- .../css-fixtures/multi-module/pages/blue.js | 8 +- .../css-fixtures/multi-module/pages/none.js | 8 +- .../css-fixtures/multi-module/pages/red.js | 8 +- .../css-fixtures/multi-page/pages/page1.js | 4 +- .../css-fixtures/multi-page/pages/page2.js | 4 +- .../next-issue-12343/pages/another-page.js | 2 +- .../next-issue-12343/pages/index.js | 2 +- .../transition-cleanup/pages/index.js | 4 +- .../transition-react/pages/index.js | 4 +- .../transition-react/pages/other.js | 4 +- .../transition-reload/pages/index.js | 4 +- .../transition-reload/pages/other.js | 4 +- .../pages/index.js | 4 +- .../pages/index.js | 4 +- .../custom-routes-i18n/pages/links.js | 16 +- .../custom-routes/pages/hello-again.js | 4 +- test/integration/custom-routes/pages/hello.js | 4 +- test/integration/custom-routes/pages/nav.js | 39 +++-- test/integration/custom-server/pages/index.js | 4 +- .../dedupes-scripts/components/hello.js | 6 +- .../dynamic-routing/pages/[name]/index.js | 64 +++---- .../dynamic-routing/pages/index.js | 162 +++++++++++------- .../integration/error-in-error/pages/index.js | 4 +- .../error-load-fail/pages/index.js | 4 +- .../export-serverless/pages/about.js | 4 +- .../export-serverless/pages/button-link.js | 2 +- .../export-serverless/pages/counter.js | 4 +- .../pages/dynamic-imports.js | 4 +- .../export-serverless/pages/dynamic.js | 4 +- .../export-serverless/pages/index.js | 32 ++-- .../export-serverless/pages/level1/about.js | 4 +- .../export-serverless/pages/level1/index.js | 4 +- test/integration/export/pages/about.js | 4 +- test/integration/export/pages/button-link.js | 2 +- test/integration/export/pages/counter.js | 4 +- .../export/pages/dynamic-imports.js | 4 +- test/integration/export/pages/dynamic.js | 4 +- .../export/pages/empty-hash-link.js | 4 +- .../export/pages/empty-query-link.js | 4 +- test/integration/export/pages/hash-link.js | 4 +- test/integration/export/pages/index.js | 34 ++-- test/integration/export/pages/level1/about.js | 4 +- test/integration/export/pages/level1/index.js | 4 +- .../fixtures/with-google/pages/index.js | 4 +- .../fixtures/with-typekit/pages/index.js | 4 +- .../pages/to-index.js | 4 +- .../pages/main-content.js | 19 +- .../hydrate-then-render/pages/index.js | 4 +- .../i18n-support-base-path/pages/another.js | 4 +- .../pages/auto-export/index.js | 4 +- .../pages/developments/index.js | 4 +- .../pages/dynamic/[slug].js | 28 +-- .../i18n-support-base-path/pages/frank.js | 28 +-- .../pages/gsp/fallback/[slug].js | 4 +- .../i18n-support-base-path/pages/gsp/index.js | 4 +- .../pages/gsp/no-fallback/[slug].js | 4 +- .../pages/gssp/[slug].js | 4 +- .../pages/gssp/index.js | 4 +- .../i18n-support-base-path/pages/index.js | 36 ++-- .../i18n-support-base-path/pages/links.js | 40 +++-- .../pages/locale-false.js | 48 ++++-- .../i18n-support-base-path/pages/mixed.js | 16 +- .../not-found/blocking-fallback/[slug].js | 4 +- .../pages/not-found/fallback/[slug].js | 4 +- .../pages/not-found/index.js | 4 +- .../pages/[[...slug]].js | 24 +-- .../pages/about.js | 7 +- .../pages/posts/[...slug].js | 3 +- .../integration/i18n-support/pages/another.js | 4 +- .../i18n-support/pages/auto-export/index.js | 4 +- .../i18n-support/pages/developments/index.js | 4 +- .../i18n-support/pages/dynamic/[slug].js | 28 +-- test/integration/i18n-support/pages/frank.js | 28 +-- .../i18n-support/pages/gsp/fallback/[slug].js | 4 +- .../i18n-support/pages/gsp/index.js | 4 +- .../pages/gsp/no-fallback/[slug].js | 4 +- .../i18n-support/pages/gssp/[slug].js | 4 +- .../i18n-support/pages/gssp/index.js | 4 +- test/integration/i18n-support/pages/index.js | 36 ++-- test/integration/i18n-support/pages/links.js | 40 +++-- .../i18n-support/pages/locale-false.js | 48 ++++-- test/integration/i18n-support/pages/mixed.js | 16 +- .../not-found/blocking-fallback/[slug].js | 4 +- .../pages/not-found/fallback/[slug].js | 4 +- .../i18n-support/pages/not-found/index.js | 4 +- test/integration/index-index/pages/links.js | 24 +-- .../pages/dynamic-route-mismatch-manual.js | 4 +- .../pages/dynamic-route-mismatch.js | 4 +- test/integration/invalid-href/pages/first.js | 4 +- .../invalid-href/pages/invalid-relative.js | 4 +- test/integration/invalid-href/pages/second.js | 4 +- test/integration/invalid-href/pages/third.js | 4 +- .../link-ref/pages/child-ref-func.js | 15 +- test/integration/link-ref/pages/child-ref.js | 4 +- test/integration/link-ref/pages/class.js | 2 +- test/integration/link-ref/pages/function.js | 2 +- .../link-with-encoding/pages/index.js | 29 +++- .../link-without-router/components/hello.js | 6 +- .../middleware-prefetch/pages/index.js | 8 +- .../basic/pages/client-side.js | 4 +- .../next-image-legacy/basic/pages/index.js | 8 +- .../custom-resolver/pages/index.js | 4 +- .../pages/index.js | 4 +- test/integration/no-page-props/pages/index.js | 12 +- test/integration/ondemand/pages/index.js | 4 +- test/integration/ondemand/pages/nav/index.js | 4 +- .../preload-viewport/pages/bot-user-agent.js | 4 +- .../preload-viewport/pages/de-duped.js | 4 +- .../preload-viewport/pages/index.js | 8 +- .../pages/invalid-prefetch.js | 4 +- .../preload-viewport/pages/invalid-ref.js | 2 +- .../preload-viewport/pages/multi-prefetch.js | 2 +- .../preload-viewport/pages/not-de-duped.js | 2 +- .../preload-viewport/pages/opt-out.js | 2 +- .../pages/prefetch-disabled-ssg.js | 4 +- .../pages/prefetch-disabled.js | 4 +- .../pages/rewrite-prefetch.js | 6 +- .../pages/ssg/fixture/index.js | 22 ++- .../pages/ssg/fixture/mismatch.js | 16 +- .../prerender-preview/pages/to-index.js | 4 +- .../prerender/pages/another/index.js | 8 +- .../pages/blocking-fallback-once/[slug].js | 4 +- .../pages/blocking-fallback-some/[slug].js | 4 +- .../pages/blocking-fallback/[slug].js | 4 +- .../prerender/pages/blog/[post]/[comment].js | 4 +- .../prerender/pages/blog/[post]/index.js | 4 +- .../integration/prerender/pages/blog/index.js | 4 +- .../pages/catchall-explicit/[...slug].js | 4 +- .../pages/catchall-optional/[[...slug]].js | 4 +- .../prerender/pages/default-revalidate.js | 8 +- .../prerender/pages/dynamic/[slug].js | 4 +- .../prerender/pages/fallback-only/[slug].js | 4 +- test/integration/prerender/pages/index.js | 87 ++++++---- .../prerender/pages/index/index.js | 4 +- test/integration/prerender/pages/something.js | 8 +- .../prerender/pages/user/[user]/profile.js | 4 +- .../production-nav/pages/another.js | 4 +- .../integration/production-nav/pages/index.js | 4 +- .../production-swcminify/pages/another.js | 4 +- .../pages/client-error.js | 4 +- .../production-swcminify/pages/counter.js | 8 +- .../pages/css-and-back.js | 4 +- .../pages/development-logs/index.js | 2 +- .../pages/dynamic/index.js | 4 +- .../production-swcminify/pages/next-import.js | 4 +- .../production-swcminify/pages/prefetch.js | 16 +- .../pages/to-nonexistent.js | 4 +- .../pages/to-shadowed-page.js | 4 +- test/integration/production/pages/another.js | 4 +- .../production/pages/client-error.js | 4 +- test/integration/production/pages/counter.js | 8 +- .../production/pages/css-and-back.js | 4 +- .../pages/development-logs/index.js | 2 +- .../production/pages/dynamic/index.js | 4 +- .../production/pages/next-import.js | 4 +- test/integration/production/pages/prefetch.js | 16 +- .../production/pages/to-nonexistent.js | 4 +- .../production/pages/to-shadowed-page.js | 4 +- test/integration/profiling/pages/index.js | 4 +- .../query-with-encoding/pages/newline.js | 11 +- .../query-with-encoding/pages/percent.js | 11 +- .../query-with-encoding/pages/plus.js | 11 +- .../query-with-encoding/pages/space.js | 11 +- .../repeated-slashes/app/pages/invalid.js | 32 ++-- .../pages/dynamic-page/[[...param]].js | 4 +- .../rewrites-client-resolving/pages/index.js | 20 +-- .../rewrites-has-condition/pages/index.js | 8 +- .../rewrites-manual-href-as/pages/another.js | 8 +- .../rewrites-manual-href-as/pages/index.js | 20 +-- .../pages/preview/[slug].js | 19 +- .../route-load-cancel-css/pages/index.js | 8 +- .../route-load-cancel/pages/index.js | 8 +- .../router-hash-navigation/pages/index.js | 8 +- .../scroll-back-restoration/pages/another.js | 4 +- .../scroll-back-restoration/pages/index.js | 21 ++- .../pages/another.js | 4 +- .../scroll-forward-restoration/pages/index.js | 21 ++- .../scss-fixtures/multi-module/pages/blue.js | 8 +- .../scss-fixtures/multi-module/pages/none.js | 8 +- .../scss-fixtures/multi-module/pages/red.js | 8 +- .../scss-fixtures/multi-page/pages/page1.js | 4 +- .../scss-fixtures/multi-page/pages/page2.js | 4 +- .../pages/index.js | 4 +- .../serverless-trace/pages/index.js | 4 +- test/integration/serverless/pages/index.js | 8 +- .../src-dir-support/src/pages/index.js | 44 +++-- .../static-page-name/pages/index.js | 4 +- .../pages/index.js | 28 +-- .../trailing-slashes/pages/external-linker.js | 4 +- .../trailing-slashes/pages/linker.js | 4 +- .../typescript/components/link.tsx | 6 +- .../with-electron/app/pages/about.js | 4 +- .../with-electron/app/pages/index.js | 4 +- .../with-router/components/header-nav.js | 29 ++-- .../production/jest/new-link-behavior.test.ts | 29 +--- .../prerender-prefetch/app/pages/index.js | 8 +- .../required-server-files/pages/index.js | 4 +- .../typescript-basic/app/pages/index.tsx | 4 +- .../app/pages/page-config.tsx | 4 +- 365 files changed, 1878 insertions(+), 1805 deletions(-) diff --git a/docs/advanced-features/codemods.md b/docs/advanced-features/codemods.md index 0a8b146b5cf28..512872ed3ea77 100644 --- a/docs/advanced-features/codemods.md +++ b/docs/advanced-features/codemods.md @@ -19,6 +19,30 @@ Codemods are transformations that run on your codebase programmatically. This al ## Next.js 13 +### `new-link` + +Safely removes `` from `next/link` or adds `legacyBehavior` prop. + +For example: + +```jsx +export default function Page() { + return ( + + About Us + + ) +} +``` + +Transforms into: + +```jsx +export default function Page() { + return About Us +} +``` + ### `next-image-to-legacy-image` Safely migrates existing Next.js 10, 11, 12 applications importing `next/image` to the renamed `next/legacy/image` import in Next.js 13. diff --git a/docs/advanced-features/i18n-routing.md b/docs/advanced-features/i18n-routing.md index c4ed2f39e0067..0e0ddf9cc3094 100644 --- a/docs/advanced-features/i18n-routing.md +++ b/docs/advanced-features/i18n-routing.md @@ -233,7 +233,7 @@ import Link from 'next/link' export default function IndexPage(props) { return ( - To /fr/another + To /fr/another ) } @@ -279,7 +279,7 @@ import Link from 'next/link' export default function IndexPage(props) { return ( - To /fr/another + To /fr/another ) } diff --git a/docs/api-reference/next.config.js/basepath.md b/docs/api-reference/next.config.js/basepath.md index 0df919b35a057..696120ba4c662 100644 --- a/docs/api-reference/next.config.js/basepath.md +++ b/docs/api-reference/next.config.js/basepath.md @@ -35,9 +35,7 @@ For example, using `/about` will automatically become `/docs/about` when `basePa export default function HomePage() { return ( <> - - About Page - + About Page ) } diff --git a/docs/api-reference/next/link.md b/docs/api-reference/next/link.md index fa3a74405accd..c8261e651f20b 100644 --- a/docs/api-reference/next/link.md +++ b/docs/api-reference/next/link.md @@ -31,19 +31,13 @@ function Home() { return ( ) @@ -56,6 +50,7 @@ export default Home - `href` - The path or URL to navigate to. This is the only required prop. It can also be an object, see [example here](/docs/api-reference/next/link.md#with-url-object) - `as` - Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes). +- [`legacyBehavior`](#if-the-child-is-a-tag) - Changes behavior so that child must be ``. Defaults to `false`. - [`passHref`](#if-the-child-is-a-custom-component-that-wraps-an-a-tag) - Forces `Link` to send the `href` property to its child. Defaults to `false` - `prefetch` - Prefetch the page in the background. Defaults to `true`. Any `` that is in the viewport (initially or through scroll) will be preloaded. Prefetch can be disabled by passing `prefetch={false}`. When `prefetch` is set to `false`, prefetching will still occur on hover. Pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md) will preload `JSON` files with the data for faster page transitions. Prefetching is only enabled in production. - [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false` @@ -78,7 +73,7 @@ function Posts({ posts }) { {posts.map((post) => (
  • - {post.title} + {post.title}
  • ))} @@ -89,6 +84,22 @@ function Posts({ posts }) { export default Posts ``` +## If the child is `` tag + +```jsx +import Link from 'next/link' + +function Legacy() { + return ( + + About Us + + ) +} + +export default Legacy +``` + ## If the child is a custom component that wraps an `` tag If the child of `Link` is a custom component that wraps an `` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/basic-features/eslint.md#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`. @@ -103,9 +114,8 @@ const RedLink = styled.a` ` function NavLink({ href, name }) { - // Must add passHref to Link return ( - + {name} ) @@ -119,7 +129,7 @@ export default NavLink ## If the child is a functional component -If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref): +If the child of `Link` is a functional component, in addition to using `passHref` and `legacyBehavior`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref): ```jsx import Link from 'next/link' @@ -136,7 +146,7 @@ const MyButton = React.forwardRef(({ onClick, href }, ref) => { function Home() { return ( - + ) @@ -162,7 +172,7 @@ function Home() { query: { name: 'test' }, }} > - About us + About us
  • @@ -172,7 +182,7 @@ function Home() { query: { slug: 'my-post' }, }} > - Blog Post + Blog Post
  • @@ -195,7 +205,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi ```jsx - About us + About us ``` @@ -205,6 +215,6 @@ The default behavior of `Link` is to scroll to the top of the page. When there i ```jsx - Disables scrolling to the top + Disables scrolling to the top ``` diff --git a/docs/api-reference/next/router.md b/docs/api-reference/next/router.md index e068a85e479ac..c108f9f60aee5 100644 --- a/docs/api-reference/next/router.md +++ b/docs/api-reference/next/router.md @@ -156,11 +156,7 @@ export default function Page(props) {

    Page: {router.query.slug}

    Count: {count}

    - - one - - two - + one two ) } diff --git a/docs/migrating/from-gatsby.md b/docs/migrating/from-gatsby.md index d8388b283c75f..98031267bc2ff 100644 --- a/docs/migrating/from-gatsby.md +++ b/docs/migrating/from-gatsby.md @@ -78,15 +78,11 @@ export default function Home() { import Link from 'next/link' export default function Home() { - return ( - - blog - - ) + return blog } ``` -Update any import statements, switch `to` to `href`, and add an `` tag as a child of the element. +Update any import statements, switch `to` to `href`. ## Data Fetching diff --git a/docs/migrating/from-react-router.md b/docs/migrating/from-react-router.md index a81482f5e1ec3..1174eaa5ed3c9 100644 --- a/docs/migrating/from-react-router.md +++ b/docs/migrating/from-react-router.md @@ -34,7 +34,7 @@ import Link from 'next/link' export default function App() { return ( - About + About ) } diff --git a/docs/routing/dynamic-routes.md b/docs/routing/dynamic-routes.md index 9f0b7f66517f4..87c02e856791d 100644 --- a/docs/routing/dynamic-routes.md +++ b/docs/routing/dynamic-routes.md @@ -63,18 +63,14 @@ function Home() { return ( diff --git a/docs/routing/introduction.md b/docs/routing/introduction.md index c2b8c8ddc8cd6..4fb506cbf7fa7 100644 --- a/docs/routing/introduction.md +++ b/docs/routing/introduction.md @@ -47,19 +47,13 @@ function Home() { return ( ) @@ -89,7 +83,7 @@ function Posts({ posts }) { {posts.map((post) => (
  • - {post.title} + {post.title}
  • ))} @@ -118,7 +112,7 @@ function Posts({ posts }) { query: { slug: post.slug }, }} > - {post.title} + {post.title} ))} diff --git a/docs/testing.md b/docs/testing.md index 3906a4e87e57c..7dca84b8879af 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -66,9 +66,7 @@ import Link from 'next/link' export default function Home() { return ( ) } @@ -183,9 +181,7 @@ import Link from 'next/link' export default function Home() { return ( ) } diff --git a/docs/upgrading.md b/docs/upgrading.md index b03728b76f4de..7c087383990b2 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -11,6 +11,8 @@ The minimum Node.js version has been bumped from 12.22.0 to 14.0.0, since 12.x h The `next/image` import was renamed to `next/legacy/image`. The `next/future/image` import was renamed to `next/image`. A [codemod is available](/docs/advanced-features/codemods.md#next-image-to-legacy-image) to safely and automatically rename your imports. +The `next/link` child can no longer be ``. Add the `legacyBehavior` prop to use the legacy behavior or remove the `` to upgrade. A [codemod is available](/docs/advanced-features/codemods.md#new-link) to automatically upgrade your code. + ## Upgrading to 12.2 If you were using Middleware prior to `12.2`, please see the [upgrade guide](https://nextjs.org/docs/messages/middleware-upgrade-guide) for more information. diff --git a/packages/next/build/jest/jest.ts b/packages/next/build/jest/jest.ts index be176de4f091f..ef17dc10a1898 100644 --- a/packages/next/build/jest/jest.ts +++ b/packages/next/build/jest/jest.ts @@ -1,7 +1,7 @@ import { loadEnvConfig } from '@next/env' import { resolve, join } from 'path' import loadConfig from '../../server/config' -import { NextConfigComplete } from '../../server/config-shared' +import type { NextConfigComplete } from '../../server/config-shared' import { PHASE_TEST } from '../../shared/lib/constants' import loadJsConfig from '../load-jsconfig' import * as Log from '../output/log' diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 09e41c61db6e4..6286da3da5285 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -556,8 +556,7 @@ export const defaultConfig: NextConfig = { // TODO: change default in next major release (current v12.1.5) legacyBrowsers: true, browsersListForSwc: false, - // TODO: change default in next major release (current v12.1.5) - newNextLinkBehavior: false, + newNextLinkBehavior: true, cpus: Math.max( 1, (Number(process.env.CIRCLE_NODE_TOTAL) || diff --git a/test/development/basic-basepath/hmr/pages/hmr/index.js b/test/development/basic-basepath/hmr/pages/hmr/index.js index 01557c87ae63f..f33384547b466 100644 --- a/test/development/basic-basepath/hmr/pages/hmr/index.js +++ b/test/development/basic-basepath/hmr/pages/hmr/index.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default () => (
    - - Bad Page + + Bad Page
    ) diff --git a/test/development/basic-basepath/misc/pages/development-logs/index.js b/test/development/basic-basepath/misc/pages/development-logs/index.js index ee339f890e917..d5470bd7ac3e0 100644 --- a/test/development/basic-basepath/misc/pages/development-logs/index.js +++ b/test/development/basic-basepath/misc/pages/development-logs/index.js @@ -4,7 +4,7 @@ export default function IndexPage() { return (
    - To About Page + To About Page
    ) diff --git a/test/development/basic-basepath/misc/pages/development-logs/link-with-no-prefetch.js b/test/development/basic-basepath/misc/pages/development-logs/link-with-no-prefetch.js index 1c3e4882dc6bf..d2b8088442fe9 100644 --- a/test/development/basic-basepath/misc/pages/development-logs/link-with-no-prefetch.js +++ b/test/development/basic-basepath/misc/pages/development-logs/link-with-no-prefetch.js @@ -3,9 +3,7 @@ import Link from 'next/link' export default function NoPrefetchPage() { return (
    - - No prefetch - + No prefetch
    ) } diff --git a/test/development/basic-basepath/misc/pages/development-logs/link-with-prefetch-false.js b/test/development/basic-basepath/misc/pages/development-logs/link-with-prefetch-false.js index 272796e78d166..dfd977fe27083 100644 --- a/test/development/basic-basepath/misc/pages/development-logs/link-with-prefetch-false.js +++ b/test/development/basic-basepath/misc/pages/development-logs/link-with-prefetch-false.js @@ -4,7 +4,7 @@ export default function PrefetchFalsePage() { return (
    - Prefetch set to false + Prefetch set to false
    ) diff --git a/test/development/basic-basepath/next-dynamic/pages/dynamic/index.js b/test/development/basic-basepath/next-dynamic/pages/dynamic/index.js index f41eae2a5804f..c3311057c2d5a 100644 --- a/test/development/basic-basepath/next-dynamic/pages/dynamic/index.js +++ b/test/development/basic-basepath/next-dynamic/pages/dynamic/index.js @@ -2,8 +2,6 @@ import Link from 'next/link' export default () => (
    - - No Chunk - + No Chunk
    ) diff --git a/test/development/basic/hmr/pages/hmr/index.js b/test/development/basic/hmr/pages/hmr/index.js index 01557c87ae63f..f33384547b466 100644 --- a/test/development/basic/hmr/pages/hmr/index.js +++ b/test/development/basic/hmr/pages/hmr/index.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default () => (
    - - Bad Page + + Bad Page
    ) diff --git a/test/development/basic/misc/pages/development-logs/index.js b/test/development/basic/misc/pages/development-logs/index.js index ee339f890e917..d5470bd7ac3e0 100644 --- a/test/development/basic/misc/pages/development-logs/index.js +++ b/test/development/basic/misc/pages/development-logs/index.js @@ -4,7 +4,7 @@ export default function IndexPage() { return (
    - To About Page + To About Page
    ) diff --git a/test/development/basic/misc/pages/development-logs/link-with-no-prefetch.js b/test/development/basic/misc/pages/development-logs/link-with-no-prefetch.js index 1c3e4882dc6bf..d2b8088442fe9 100644 --- a/test/development/basic/misc/pages/development-logs/link-with-no-prefetch.js +++ b/test/development/basic/misc/pages/development-logs/link-with-no-prefetch.js @@ -3,9 +3,7 @@ import Link from 'next/link' export default function NoPrefetchPage() { return (
    - - No prefetch - + No prefetch
    ) } diff --git a/test/development/basic/misc/pages/development-logs/link-with-prefetch-false.js b/test/development/basic/misc/pages/development-logs/link-with-prefetch-false.js index 272796e78d166..dfd977fe27083 100644 --- a/test/development/basic/misc/pages/development-logs/link-with-prefetch-false.js +++ b/test/development/basic/misc/pages/development-logs/link-with-prefetch-false.js @@ -4,7 +4,7 @@ export default function PrefetchFalsePage() { return (
    - Prefetch set to false + Prefetch set to false
    ) diff --git a/test/development/basic/next-dynamic/pages/dynamic/index.js b/test/development/basic/next-dynamic/pages/dynamic/index.js index f41eae2a5804f..c3311057c2d5a 100644 --- a/test/development/basic/next-dynamic/pages/dynamic/index.js +++ b/test/development/basic/next-dynamic/pages/dynamic/index.js @@ -2,8 +2,6 @@ import Link from 'next/link' export default () => (
    - - No Chunk - + No Chunk
    ) diff --git a/test/e2e/app-dir/app-prefetch/app/page.js b/test/e2e/app-dir/app-prefetch/app/page.js index be3690c6321be..7cf985c66b793 100644 --- a/test/e2e/app-dir/app-prefetch/app/page.js +++ b/test/e2e/app-dir/app-prefetch/app/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function HomePage() { return ( <> - - To Dashboard + + To Dashboard ) diff --git a/test/e2e/app-dir/app-static/app/blog/[author]/page.js b/test/e2e/app-dir/app-static/app/blog/[author]/page.js index c8e2e05c45033..cbdefb1dd8837 100644 --- a/test/e2e/app-dir/app-static/app/blog/[author]/page.js +++ b/test/e2e/app-dir/app-static/app/blog/[author]/page.js @@ -10,34 +10,34 @@ export default function Page({ params }) {

    /blog/[author]

    {JSON.stringify(params)}

    {Date.now()}

    - - /blog/tim + + /blog/tim
    - - /blog/seb + + /blog/seb
    - - /blog/styfle + + /blog/styfle
    - - /blog/tim/first-post + + /blog/tim/first-post
    - - /blog/seb/second-post + + /blog/seb/second-post
    - - /blog/styfle/first-post + + /blog/styfle/first-post
    - - /dynamic-no-gen-params/first + + /dynamic-no-gen-params/first
    diff --git a/test/e2e/app-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js b/test/e2e/app-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js index 27b661a09fdca..7b7ee8e7806b6 100644 --- a/test/e2e/app-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js +++ b/test/e2e/app-dir/app-static/app/dynamic-no-gen-params/[slug]/page.js @@ -6,13 +6,13 @@ export default function Page({ params }) {

    /dynamic-no-gen-params

    {JSON.stringify(params)}

    - - /dynamic-no-gen-params/second + + /dynamic-no-gen-params/second
    - - /blog/styfle + + /blog/styfle
    diff --git a/test/e2e/app-dir/app/app/catch-all-link/page.js b/test/e2e/app-dir/app/app/catch-all-link/page.js index 59157f985f1e7..1170d49fa5d2d 100644 --- a/test/e2e/app-dir/app/app/catch-all-link/page.js +++ b/test/e2e/app-dir/app/app/catch-all-link/page.js @@ -4,13 +4,16 @@ export default function Page() { return ( <>
    - - To catch-all + + To catch-all
    - - To optional catch-all + + To optional catch-all
    diff --git a/test/e2e/app-dir/app/app/internal/page.js b/test/e2e/app-dir/app/app/internal/page.js index ddbc93ea55854..525104c574ac8 100644 --- a/test/e2e/app-dir/app/app/internal/page.js +++ b/test/e2e/app-dir/app/app/internal/page.js @@ -4,13 +4,13 @@ export default function Page() { return (
    - - Navigate Rewrite + + Navigate Rewrite
    - - Navigate Redirect + + Navigate Redirect
    diff --git a/test/e2e/app-dir/app/app/link-hard-push/[id]/page.js b/test/e2e/app-dir/app/app/link-hard-push/[id]/page.js index c440f0582c337..0ce09bfa6ab7e 100644 --- a/test/e2e/app-dir/app/app/link-hard-push/[id]/page.js +++ b/test/e2e/app-dir/app/app/link-hard-push/[id]/page.js @@ -6,8 +6,8 @@ export default function Page({ params }) { return ( <>

    {nanoid()}

    {' '} - - To {other} + + To{other} ) diff --git a/test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js b/test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js index c90e93f74c78d..6f69c10520d12 100644 --- a/test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js +++ b/test/e2e/app-dir/app/app/link-hard-replace/[id]/page.js @@ -6,8 +6,8 @@ export default function Page({ params }) { return ( <>

    {nanoid()}

    {' '} - - To {other} + + To{other} ) diff --git a/test/e2e/app-dir/app/app/link-hard-replace/page.js b/test/e2e/app-dir/app/app/link-hard-replace/page.js index 340baa107e373..0f099a798f596 100644 --- a/test/e2e/app-dir/app/app/link-hard-replace/page.js +++ b/test/e2e/app-dir/app/app/link-hard-replace/page.js @@ -5,11 +5,11 @@ export default function Page() { return ( <>

    {nanoid()}

    - - Self Link + + Self Link - - Subpage + + Subpage ) diff --git a/test/e2e/app-dir/app/app/link-hard-replace/subpage/page.js b/test/e2e/app-dir/app/app/link-hard-replace/subpage/page.js index cd586543ab752..ecb43519aa8b3 100644 --- a/test/e2e/app-dir/app/app/link-hard-replace/subpage/page.js +++ b/test/e2e/app-dir/app/app/link-hard-replace/subpage/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page() { return ( - - Self Link + + Self Link ) } diff --git a/test/e2e/app-dir/app/app/link-soft-push/page.js b/test/e2e/app-dir/app/app/link-soft-push/page.js index 049e5be9c49c7..a83690e8b5107 100644 --- a/test/e2e/app-dir/app/app/link-soft-push/page.js +++ b/test/e2e/app-dir/app/app/link-soft-push/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page() { return ( - - With ID + + With ID ) } diff --git a/test/e2e/app-dir/app/app/link-soft-replace/page.js b/test/e2e/app-dir/app/app/link-soft-replace/page.js index c65758d99076c..26a535bb1a78a 100644 --- a/test/e2e/app-dir/app/app/link-soft-replace/page.js +++ b/test/e2e/app-dir/app/app/link-soft-replace/page.js @@ -5,11 +5,11 @@ export default function Page() { return ( <>

    {nanoid()}

    - - Self Link + + Self Link - - Subpage + + Subpage ) diff --git a/test/e2e/app-dir/app/app/link-soft-replace/subpage/page.js b/test/e2e/app-dir/app/app/link-soft-replace/subpage/page.js index 6ee17de065089..b1fe8890da760 100644 --- a/test/e2e/app-dir/app/app/link-soft-replace/subpage/page.js +++ b/test/e2e/app-dir/app/app/link-soft-replace/subpage/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page() { return ( - - Self Link + + Self Link ) } diff --git a/test/e2e/app-dir/app/app/link-with-as/page.js b/test/e2e/app-dir/app/app/link-with-as/page.js index 12a33746cc9fe..8e3eff7d0c16d 100644 --- a/test/e2e/app-dir/app/app/link-with-as/page.js +++ b/test/e2e/app-dir/app/app/link-with-as/page.js @@ -6,8 +6,9 @@ export default function Page() { - To info 123 + To info 123 ) diff --git a/test/e2e/app-dir/app/app/nested-navigation/TabNavItem.js b/test/e2e/app-dir/app/app/nested-navigation/TabNavItem.js index 3e1cbf3dd95dd..3e74c679f9329 100644 --- a/test/e2e/app-dir/app/app/nested-navigation/TabNavItem.js +++ b/test/e2e/app-dir/app/app/nested-navigation/TabNavItem.js @@ -2,8 +2,8 @@ import Link from 'next/link' export const TabNavItem = ({ children, href }) => { return ( - - {children} + + {children} ) } diff --git a/test/e2e/app-dir/app/app/pages-linking/page.js b/test/e2e/app-dir/app/app/pages-linking/page.js index 19b7cc4b861b8..d32b739de990e 100644 --- a/test/e2e/app-dir/app/app/pages-linking/page.js +++ b/test/e2e/app-dir/app/app/pages-linking/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page(props) { return ( - - To Pages Page + + To Pages Page ) } diff --git a/test/e2e/app-dir/app/app/redirect/next-config-redirect/page.js b/test/e2e/app-dir/app/app/redirect/next-config-redirect/page.js index 95038b8326dcd..b2f96fb405b40 100644 --- a/test/e2e/app-dir/app/app/redirect/next-config-redirect/page.js +++ b/test/e2e/app-dir/app/app/redirect/next-config-redirect/page.js @@ -3,8 +3,8 @@ import Link from 'next/link' export default function Page() { return ( <> - - To Dashboard through /redirect/a + + To Dashboard through /redirect/a ) diff --git a/test/e2e/app-dir/app/app/redirect/next-middleware-redirect/page.js b/test/e2e/app-dir/app/app/redirect/next-middleware-redirect/page.js index 49a721599e253..7323ef64adb96 100644 --- a/test/e2e/app-dir/app/app/redirect/next-middleware-redirect/page.js +++ b/test/e2e/app-dir/app/app/redirect/next-middleware-redirect/page.js @@ -3,8 +3,8 @@ import Link from 'next/link' export default function Page() { return ( <> - - To Dashboard through /redirect/a + + To Dashboard through /redirect/a ) diff --git a/test/e2e/app-dir/app/app/rewrites/page.js b/test/e2e/app-dir/app/app/rewrites/page.js index ae97d2af2cbd4..eeae4be1361c4 100644 --- a/test/e2e/app-dir/app/app/rewrites/page.js +++ b/test/e2e/app-dir/app/app/rewrites/page.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page() { return ( - - To Dashboard Rewritten + + To Dashboard Rewritten ) } diff --git a/test/e2e/app-dir/app/app/same-layout/first/page.js b/test/e2e/app-dir/app/app/same-layout/first/page.js index bf4ba9e2455b9..2c2ebede77b4d 100644 --- a/test/e2e/app-dir/app/app/same-layout/first/page.js +++ b/test/e2e/app-dir/app/app/same-layout/first/page.js @@ -4,8 +4,8 @@ export default function Page() { return ( <>

    hello from same-layout/first

    - - To Second + + To Second ) diff --git a/test/e2e/app-dir/app/app/same-layout/second/page.js b/test/e2e/app-dir/app/app/same-layout/second/page.js index 9d981dcb708aa..9eefb7df26093 100644 --- a/test/e2e/app-dir/app/app/same-layout/second/page.js +++ b/test/e2e/app-dir/app/app/same-layout/second/page.js @@ -4,8 +4,8 @@ export default function Page() { return ( <>

    hello from same-layout/second

    - - To First + + To First ) diff --git a/test/e2e/app-dir/app/app/template/clientcomponent/other/page.js b/test/e2e/app-dir/app/app/template/clientcomponent/other/page.js index 24c81bb71930d..dc90e11c70e5f 100644 --- a/test/e2e/app-dir/app/app/template/clientcomponent/other/page.js +++ b/test/e2e/app-dir/app/app/template/clientcomponent/other/page.js @@ -3,8 +3,8 @@ export default function Page() { return ( <>

    Other Page

    - - To Page + + To Page ) diff --git a/test/e2e/app-dir/app/app/template/clientcomponent/page.js b/test/e2e/app-dir/app/app/template/clientcomponent/page.js index 89378c7e29f17..4c9988bb9b33b 100644 --- a/test/e2e/app-dir/app/app/template/clientcomponent/page.js +++ b/test/e2e/app-dir/app/app/template/clientcomponent/page.js @@ -4,8 +4,8 @@ export default function Page() { return ( <>

    Page

    - - To Other + + To Other ) diff --git a/test/e2e/app-dir/app/app/template/servercomponent/other/page.js b/test/e2e/app-dir/app/app/template/servercomponent/other/page.js index 2ed3a0fa15cef..b9892154b6d4e 100644 --- a/test/e2e/app-dir/app/app/template/servercomponent/other/page.js +++ b/test/e2e/app-dir/app/app/template/servercomponent/other/page.js @@ -3,8 +3,8 @@ export default function Page() { return ( <>

    Other Page

    - - To Page + + To Page ) diff --git a/test/e2e/app-dir/app/app/template/servercomponent/page.js b/test/e2e/app-dir/app/app/template/servercomponent/page.js index 27a7097ccd650..bb83fba1ea7fa 100644 --- a/test/e2e/app-dir/app/app/template/servercomponent/page.js +++ b/test/e2e/app-dir/app/app/template/servercomponent/page.js @@ -4,8 +4,8 @@ export default function Page() { return ( <>

    Page

    - - To Other + + To Other ) diff --git a/test/e2e/app-dir/app/app/with-id/page.js b/test/e2e/app-dir/app/app/with-id/page.js index 07beecc4203fa..afaab4d7d4aa0 100644 --- a/test/e2e/app-dir/app/app/with-id/page.js +++ b/test/e2e/app-dir/app/app/with-id/page.js @@ -5,8 +5,8 @@ export default function Page() { return ( <>

    {nanoid()}

    - - To Navigation + + To Navigation ) diff --git a/test/e2e/app-dir/app/pages/app-linking.js b/test/e2e/app-dir/app/pages/app-linking.js index 0a8e0289afe47..3ef5245032ae9 100644 --- a/test/e2e/app-dir/app/pages/app-linking.js +++ b/test/e2e/app-dir/app/pages/app-linking.js @@ -2,8 +2,8 @@ import Link from 'next/link' export default function Page(props) { return ( - - To App Page + + To App Page ) } diff --git a/test/e2e/app-dir/app/pages/link-to-rewritten-path.js b/test/e2e/app-dir/app/pages/link-to-rewritten-path.js index 177f41aa73e33..ed212bfb08592 100644 --- a/test/e2e/app-dir/app/pages/link-to-rewritten-path.js +++ b/test/e2e/app-dir/app/pages/link-to-rewritten-path.js @@ -3,8 +3,8 @@ import Link from 'next/link' export default function Page(props) { return ( <> - - Exists but not routed + + Exists but not routed ) diff --git a/test/e2e/app-dir/asset-prefix/app/page.js b/test/e2e/app-dir/asset-prefix/app/page.js index f02fd1b341b1c..c00ce2fb17b1a 100644 --- a/test/e2e/app-dir/asset-prefix/app/page.js +++ b/test/e2e/app-dir/asset-prefix/app/page.js @@ -3,8 +3,8 @@ export default function HomePage() { return ( <>

    - - To a with trailing slash + + To a with trailing slash

    diff --git a/test/e2e/app-dir/rsc-basic/app/next-api/link/page.js b/test/e2e/app-dir/rsc-basic/app/next-api/link/page.js index 13a9616be5e61..6f6893b2c31de 100644 --- a/test/e2e/app-dir/rsc-basic/app/next-api/link/page.js +++ b/test/e2e/app-dir/rsc-basic/app/next-api/link/page.js @@ -8,8 +8,8 @@ export default function LinkPage({ searchParams }) { <>

    query:{id}

    - - next id + + next id