-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ssr-caching example with getServerSideProps (#11032)
* Replace getInitialProps by getServerSideProps * Replace getServerSideProps getStaticProps
- Loading branch information
Showing
2 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
|
||
export default function(props) { | ||
return ( | ||
<div> | ||
<h1>My {props.id} blog post</h1> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. | ||
</p> | ||
</div> | ||
) | ||
} | ||
|
||
export async function getStaticProps({ params: { id } }) { | ||
return { props: { id } } | ||
} | ||
|
||
export async function getStaticPaths() { | ||
return { | ||
paths: [ | ||
{ params: { id: 'first' } }, | ||
{ params: { id: 'second' } }, | ||
{ params: { id: 'last' } }, | ||
], | ||
fallback: true, | ||
} | ||
} |