1e3534e169
The intention is to show people the correlation between things, in this case, understand the usage of the same key from the props and the rehydration. Hopefully, this change will bring value as it has done with some Juniors already.
34 lines
782 B
JavaScript
34 lines
782 B
JavaScript
import App from '../components/App'
|
||
import InfoBox from '../components/InfoBox'
|
||
import Header from '../components/Header'
|
||
import Submit from '../components/Submit'
|
||
import PostList, {
|
||
ALL_POSTS_QUERY,
|
||
allPostsQueryVars,
|
||
} from '../components/PostList'
|
||
import { initializeApollo, addApolloState } from '../lib/apolloClient'
|
||
|
||
const IndexPage = () => (
|
||
<App>
|
||
<Header />
|
||
<InfoBox>ℹ️ This page shows how to use SSG with Apollo.</InfoBox>
|
||
<Submit />
|
||
<PostList />
|
||
</App>
|
||
)
|
||
|
||
export async function getStaticProps() {
|
||
const apolloClient = initializeApollo()
|
||
|
||
await apolloClient.query({
|
||
query: ALL_POSTS_QUERY,
|
||
variables: allPostsQueryVars,
|
||
})
|
||
|
||
return addApolloState(apolloClient, {
|
||
props: {},
|
||
revalidate: 1,
|
||
})
|
||
}
|
||
|
||
export default IndexPage
|