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