Next.js example
New to topics? Read the documentation here!
Our examples are located under nodejs/next:
- nodejs/next/hello-world: a hello world. There's an in-tree one at: github.com/vercel/next.js/tree/e75361fd03872b097e817634c049b3185f24cf56/examples/hello-world, but ours is truly minimal
- nodejs/next/hoc: shows how to use a higher order component (HOC) to factor out
getStaticProps
across two pages: nodejs/next/hoc/pages/index.js and nodejs/next/hoc/pages/notindex.js - nodejs/next/typescript: simple TypeScript example, minimized from: github.com/vercel/next.js/tree/d61b0761efae09bd9cb1201ff134ed8950d9deca/examples/with-typescriptNotably, that shows how
require
errors are avoided in that case as mentioned at: stackoverflow.com/questions/64926174/module-not-found-cant-resolve-fs-in-next-js-application/70363153#70363153 - nodejs/next/localStorage: a counter that is persistent across page reloads by using
localStorage
. Used in: stackoverflow.com/questions/54819721/next-js-access-localstorage-before-rendering-page/68136224#68136224
Solved ones:
- solved by preview mode in Next.js 12:
- ISR was basically unusable for CRUD websites because you can't force a one-off immediate page update: