Files
4b66771895 Remove deprecated legacyBehavior and passHref prop from Link component (#83003)
The `legacyBehavior` prop of the `Link` component has been deprecated
since #77473. For Next.js 16, we're finally removing support for it.
Consequently, we're also removing support for the `passHref` prop, which
was only useful in conjunction with the `legacyBehavior` prop.

A [codemod is
available](https://nextjs.org/docs/app/guides/upgrading/codemods#new-link)
to help you automatically upgrade your codebase.

reverts #77473

---------

Co-authored-by: Sebastian Sebbie Silbermann <[email protected]>
2025-08-26 14:04:27 +02:00

99 lines
2.4 KiB
JavaScript

import Head from "next/head";
import Link from "next/link";
import { useRouter } from "next/router";
import useSWR from "swr";
import fetcher from "../../lib/fetcher";
import Header from "../../components/header";
import Footer from "../../components/footer";
export default function Actor() {
const router = useRouter();
const { name } = router.query;
const { data, error, isLoading } = useSWR(`/api/actors/${name}`, fetcher);
if (error) return <div>failed to load</div>;
if (isLoading) return <div>loading...</div>;
if (!data) return null;
return (
<div className="container">
<Head>
<title>Next with Neo4j</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<Header title={name} />
<main>
<div className="actor">
<div className="info">
<h2>Information</h2>
<div>
<strong>Born: </strong>
{data.actor.born}
</div>
</div>
<div className="movies">
<h2>Movies</h2>
{data.actor.movies.map((movie) => (
<div key={movie}>
<Link
href="/movie/[title]"
as={{
pathname: `/movie/${encodeURIComponent(movie)}`,
}}
>
{movie}
</Link>
</div>
))}
</div>
</div>
<div className="back">
<Link href="/">🔙 Go Back</Link>
</div>
</main>
<Footer />
<style jsx>
{`
.container {
width: 100vw;
min-height: 100vh;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
main {
display: flex;
width: 100%;
justify-content: center;
padding: 2rem 0;
text-align: center;
flex-direction: column;
}
.actor {
margin-bottom: 2rem;
}
.movies div {
margin-bottom: 5px;
}
.movies a {
text-decoration: underline;
}
.back {
padding: 1rem 0;
}
.back a {
font-weight: bold;
}
`}
</style>
</div>
);
}