Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ssr-caching example with getServerSideProps #11032

Merged
merged 2 commits into from Mar 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 13 additions & 15 deletions examples/ssr-caching/pages/blog.js
@@ -1,19 +1,17 @@
import React from 'react'

export default class extends React.Component {
static getInitialProps({ query: { id } }) {
return { id }
}
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>
)
}

render() {
return (
<div>
<h1>My {this.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 getServerSideProps({ query: { id } }) {
pavanetti marked this conversation as resolved.
Show resolved Hide resolved
return { props: { id } }
}