[Feature Request] "Extract to component" refactor
Opened this issue · 1 comments
yume-chan commented
Like the built-in "extract to function" refactor, I propose an "extract to component" refactor:
- Select some jsx elements
- Invoke the "extract to component" refactor
- It automatically analyzes dependencies of selected code, generates a new component with these props, and replaces selection with an element of the newly created component type.
It may have some variants:
- Extract to component in same module
- Extract to component in a new file
Multiples by:
- Extract to functional component
- Extract to functional component wrapped with
React.memo
- Extract to class component (maybe not needed as class component is not mainstream anymore)
Kingwl commented
It's a bit complex. But a good idea.