Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update with-loading example to SSG (#11050)
* Update getInitialProps to getStaticProps * Updated example Co-authored-by: Luis Alvarez <luis@zeit.co>
- Loading branch information
1 parent
b596c21
commit 31a6410
Showing
6 changed files
with
34 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import React from 'react' | ||
|
||
const AboutPage = () => <p>This is about Next.js!</p> | ||
|
||
AboutPage.getInitialProps = async () => { | ||
export async function getServerSideProps() { | ||
await new Promise(resolve => { | ||
setTimeout(resolve, 500) | ||
}) | ||
return {} | ||
return { props: {} } | ||
} | ||
|
||
export default AboutPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import React from 'react' | ||
|
||
const ForeverPage = () => <p>This page was rendered for a while!</p> | ||
|
||
ForeverPage.getInitialProps = async () => { | ||
export async function getServerSideProps() { | ||
await new Promise(resolve => { | ||
setTimeout(resolve, 3000) | ||
}) | ||
return {} | ||
return { props: {} } | ||
} | ||
|
||
export default ForeverPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import React from 'react' | ||
|
||
const IndexPage = () => <p>Hello Next.js!</p> | ||
|
||
export default IndexPage |