import Link from 'next/link';
export default function Index() {
return (
<div>
<h1>Hello Next.js 👋</h1>
<Link href="/about">
<a>About</a>
</Link>
</div>
);
}
import Link from 'next/link';
export default function About() {
return (
<div>
<p>This is the about page</p>
<Link href="/">
<a>Go home</a>
</Link>
</div>
);
}
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next export"
},
"dependencies": {
"next": "^8.0.0",
"react": "^16.5.1",
"react-dom": "^16.5.1"
}
}
This is the about page
import Link from 'next/link';
export default () => (
<div>
<h1>Hello, this is the homepage</h1>
<p>I'm only 0.59 KB after gzip.</p>
<Link href="/cowsay">
<a>Cowsay</a>
</Link>
</div>
);
import Link from 'next/link';
// only being loaded on \`/cowsay\`
import cowsay from 'cowsay-browser';
export default () => (
<div>
<p>This page costs 29.8 KB after gzip!</p>
<pre>{cowsay.say({ text: 'I am a big package!' })}</pre>
<Link href="/">
<a>Go home</a>
</Link>
</div>
);
I'm only 0.59 KB after gzip.
This page costs 29.8 KB after gzip!
_____________________ < I am a big package! > --------------------- \ ^__^ \ (oo)_______ (__) )\/\ ||----w | || ||
With Next.js, server rendering React applications has never been easier, no matter where your data is coming from.
No need to learn a new framework. Exporting a static site with Next.js is as easy as a single command.
Next.js comes with styled-jsx
included, but it also works with every CSS-in-JS solution you know and love.
Automatic code splitting, filesystem based routing, hot code reloading and universal rendering.
Learn Next.jsComplete control over Babel and Webpack. Customizable server, routing and next-plugins.
View Full DocumentationOptimized for a smaller build size, faster dev compilation and dozens of other improvements.
View Showcase