remove-forward-ref
Inline forwardRef(...) render functions and pass ref through props.
Usage
bash
Development
bash
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Inline forwardRef render functions and move ref into props
npx codemod @react-new/remove-forward-ref
Inline forwardRef(...) render functions and pass ref through props.
bash
bash
This is one example from the codemod's test cases. The codemod may handle many more cases.
Build your own codemod and share it with the community.
1 import { forwardRef } from 'react';
2
3 const MyComponent = forwardRef(function Component(
4 myProps: Props,
5 myRef: React.ForwardedRef<HTMLButtonElement>
6 ) {
7 return null;
8 });