forked from vercel/next.js
/
client-only.js
30 lines (28 loc) · 962 Bytes
/
client-only.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import App from '../components/App'
import InfoBox from '../components/InfoBox'
import Header from '../components/Header'
import Submit from '../components/Submit'
import PostList from '../components/PostList'
import { withApollo } from '../lib/apollo'
const ClientOnlyPage = props => (
<App>
<Header />
<InfoBox>
ℹ️ This example shows how to disable apollos query fetching on the server.
If you <a href="/client-only">reload</a> this page, you will see a loader
since Apollo didn't fetch any data on the server. This allows{' '}
<a
href="https://nextjs.org/blog/next-9#automatic-static-optimization"
target="_blank"
rel="noopener noreferrer"
>
automatic static optimization
</a>
.
</InfoBox>
<Submit />
<PostList />
</App>
)
// Disable apollo ssr fetching in favour of automatic static optimization
export default withApollo({ ssr: false })(ClientOnlyPage)