Reputation: 55
That is, can I statically generate a header and main content using SSR
Upvotes: 3
Views: 1358
Reputation: 318
Unfortunately, you can't achieve such a thing with pure next.js.
As stated in their docs for SSR:
getServerSideProps can only be exported from a page. You can’t export it from non-page files.
Same goes for SSG:
getStaticProps can only be exported from a page. You cannot export it from non-page files, _app, _document, or _error.
You can only use next.js data-fetching on page level.
Upvotes: 5