Skip to content

Commit

Permalink
Update ssr-caching example with getServerSideProps (#11032)
Browse files Browse the repository at this point in the history
* Replace getInitialProps by getServerSideProps

* Replace getServerSideProps getStaticProps
  • Loading branch information
pavanetti authored Mar 14, 2020
1 parent 71f9719 commit bb3cce2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
19 changes: 0 additions & 19 deletions examples/ssr-caching/pages/blog.js

This file was deleted.

28 changes: 28 additions & 0 deletions examples/ssr-caching/pages/blog/[id].js
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,
}
}

0 comments on commit bb3cce2

Please sign in to comment.