CCodemod

next/13/upsert-use-client-directive

No description available

Legacy
next.jsmigration
Public
34 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

Since Next.js 13.4, you can mark the files that contain only client-side code with the use client directive at the top.

The codemod will look for identifiers and string literals common for files that contain client-side code, such as React hooks or event handlers. On the other hand, it will not upsert any directive should it spot elements indicating server-side code.

The codemod will not remove the existing use client directive even if it would suggest otherwise due to the code in question.

Example

Before

jsx

After

jsx

Ready to contribute?

Build your own codemod and share it with the community.