C

react/replace-react-fc-typescript

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

This codemod removes React.FC, React.FunctionComponent and React.SFC and replaces the Props as the type of the unique argument in the component definition.

This codemod supports:

  • Inline defined props.
  • Generics.
  • Props defined with intersection.
  • Component modules defined using intersection.
  • Regular named functions.
  • Functions that accept a component definition.
  • Using FC, FunctionComponent and SFC as a named export.

Before:

jsx

After:

tsx

Ready to contribute?

Build your own codemod and share it with the community.