C

next/13/replace-use-search-params

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

A recent update in Next.js brought a breaking change: the useSearchParams hook no longer includes params. To ease the migration, the new useCompatSearchParams hook can be used. This hook mimics the behavior of the old useSearchParams in two ways:

  • it includes both params and searchParams
  • params overwrite any conflicting values in searchParams

Example

Before

jsx

After

jsx

Ready to contribute?

Build your own codemod and share it with the community.