Tautan JS berikutnya
import Link from 'next/link'
<Link href="/grapper"> <a>grapper</a></Link>
CodePadding
import Link from 'next/link'
<Link href="/grapper"> <a>grapper</a></Link>
<Link href="/shop/[pid]" as={`/shop/${id}`}>
<a>Shop by menu</a>
</Link>
import Link from 'next/link'
import Head from 'next/head'
function HomePage(props) {
return (
<>
<Head>
<title>Welcome to Next.js!</title>
</Head>
<div>Welcome to Next.js!</div>
<Link href="/users">> <a>Users</a></Link>
<br/>
<img src="/logo.png" alt="EducativeLogo" />
</>
)
}
export async function getServerSideProps(context) {
const res = await fetch('https://api.github.com/repos/vercel/next.js')
const json = await res.json()
return {
props: { stars: json.stargazers_count }
}
}
export default HomePage