Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Update template to use getStaticProps over getInitialProps #65

Open
2 tasks done
LinnJS opened this issue Aug 8, 2022 · 1 comment
Open
2 tasks done

Update template to use getStaticProps over getInitialProps #65

LinnJS opened this issue Aug 8, 2022 · 1 comment

Comments

@LinnJS
Copy link

LinnJS commented Aug 8, 2022

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

  • Refactor _app file to use getStaticProps over getInitialProps.
  • Use functional components/hooks over class based hooks in _app
@LinnJS
Copy link
Author

LinnJS commented Aug 16, 2022

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

  • Added TypeScript
  • Made NextJS build statically
  • Has functional programming styles (no classes)
  • TailwindCSS added but CSS modules not yet remediated

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant