CCodemod

next/13/remove-get-static-props

No description available

Legacy
next.jsmigration
Public
45 downloads
0 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

The following data fetching methods are no longer available in the app directory:

  • getStaticPaths,
  • getServerSideProps,
  • getStaticProps.

The codemod migrates the data fetching functions into the supported in the app directory:

  • getStaticPaths -> generateStaticParams
  • getServerSideProps -> getData
  • getStaticProps -> getData (used in the component)

If the getStaticPaths function has only one expression in the return statement, it will be inlined within the nextData function, otherwise it will remain unchanged.

When migrating the getServerSideProps functions, the codemod assumes that only the params property of the first argument is used.

It additionally adds types for aforementioned params and page props.

It will also add the revalidate and dynamicParams route segment properties.

Example

Before

jsx

After

jsx

Ready to contribute?

Build your own codemod and share it with the community.