Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] "Extract to component" refactor #109

Open
yume-chan opened this issue Jan 26, 2021 · 1 comment
Open

[Feature Request] "Extract to component" refactor #109

yume-chan opened this issue Jan 26, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@yume-chan
Copy link

Like the built-in "extract to function" refactor, I propose an "extract to component" refactor:

  1. Select some jsx elements
  2. Invoke the "extract to component" refactor
  3. 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:

  1. Extract to component in same module
  2. Extract to component in a new file

Multiples by:

  1. Extract to functional component
  2. Extract to functional component wrapped with React.memo
  3. Extract to class component (maybe not needed as class component is not mainstream anymore)
@Kingwl
Copy link
Member

Kingwl commented Feb 22, 2021

It's a bit complex. But a good idea.

@Kingwl Kingwl added enhancement New feature or request help wanted Extra attention is needed labels Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants