mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
BREAKING CHANGE Since `next export` has been printing a deprecation warning since https://github.com/vercel/next.js/pull/47376, its safe to remove in semver-major. The upgrade path is to simply add `output: 'export'` in `next.config.js` - everything will continue to work the same. This config greatly improves the `next dev` experience today. And in the future, it will improve performance of `next build` because we no longer need to do two passes (build then export).
30 lines
566 B
JavaScript
30 lines
566 B
JavaScript
import Link from 'next/link'
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
export async function getStaticProps() {
|
|
const text = fs
|
|
.readFileSync(path.join(process.cwd(), 'world.txt'), 'utf8')
|
|
.trim()
|
|
return {
|
|
props: {
|
|
world: text,
|
|
time: new Date().getTime(),
|
|
},
|
|
}
|
|
}
|
|
|
|
export default ({ world, time }) => (
|
|
<>
|
|
<p>hello {world}</p>
|
|
<span id="anotherTime">time: {time}</span>
|
|
<Link href="/" id="home">
|
|
to home
|
|
</Link>
|
|
<br />
|
|
<Link href="/something" id="something">
|
|
to something
|
|
</Link>
|
|
</>
|
|
)
|