Seeking assistance to extract data from an array on one page and display it on another page. I am working with NextJs, Typescript, and AppRoute.
Code in app/page.tsx:
import Image from 'next/image'
import Link from 'next/link'
const listMember = [
{
id: 1,
name: "name1",
age: 20,
},
{
id: 2,
name: "name2",
age: 18,
},
{
id: 3,
name: "name3",
age: 2,
}
]
export default function HomePage() {
return (
<>
<ul className="px-5">
{listMember.map(member =>
<li>
<Link
href={{
pathname: "/Detail",
query: member.name
}}>{member.name}</Link>
</li>
)}
</ul>
</>
)
}
Code in app/Detail/page.tsx:
import HomePage from "../page";
export default function Detail() {
return (
<>
<h1>
This is detail page of {HomePage.listMember.name}
</h1>
</>
)
}
Attempted using route but encountered issues.