rsnext/test/integration/prerender/pages/something.js
JJ Kasper ae78e8f5be Fix get(Static|Initial)Props re-running when updating query (#9907)
* Add failing test for re-calling getStaticProps after updating query

* Fix get(Static|Initial)Props re-running when updating query

* Update invalid export tests

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-03 15:36:24 -05:00

35 lines
834 B
JavaScript

import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
// eslint-disable-next-line camelcase
export async function unstable_getStaticProps({ params }) {
return {
props: {
world: 'world',
params: params || {},
time: new Date().getTime(),
random: Math.random(),
},
revalidate: false,
}
}
export default ({ world, time, params, random }) => {
return (
<>
<p>hello: {world}</p>
<span>time: {time}</span>
<div id="random">{random}</div>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
</Link>
</>
)
}