sanity-io / sanity-template-nextjs-landing-pages

A Sanity powered landing page builder in Next.js for https://sanity.io/create
https://www.sanity.io/create/?template=sanity-io%2Fsanity-template-nextjs-landing-pages
158 stars 54 forks source link

Update template to use getStaticProps over getInitialProps #65

Open LinnJS opened 2 years ago

LinnJS commented 2 years ago

Description

NextJS static site optimization is disabled site wide when getInitialProps is used in _app file. Would be cool to see this template use getStaticProps so people using this template could reap the benefits on NextJS SSG.

Further more feels like using class components are a bit out of date. I have tried refactoring this a couple times with no avail. Would also be cool to see this refactored into functional components.

I am not an expert on the NextJS APIs so have been having a hard time finding a way to access all those same props the same way as the class version.

Acceptance Criteria

LinnJS commented 2 years ago

Modernized this template a bit over here if anyone is interested.

https://github.com/LinnJS/sanity-nextjs-landing-pages