Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Smart React Component ExtractorNew to Visual Studio Code? Get it now.
Smart React Component Extractor

Smart React Component Extractor

klog

|
2,021 installs
| (1) | Free
Extract the selected code to a new component in a few clicks. The extension will take care of all imports and props for you.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Smart React Component Extractor

preview

Usage

  1. Select code you want to extract
  2. Ctrl + Shift + P to run command pallete
  3. Select "Smart Extract React Component"
  4. Input new component name
  5. Your new component is created. All imports and props are handled by the Smart React Component Extractor!!!

Motivation

It’s not always possible to keep code clean and declarative. After a dozen commits, your components become huge and unreadable. And then comes refactoring. You split component into smaller ones. It takes time. You can't just Ctrl-X Ctrl-V. So I decided to write extension, which will help you refactor React components

Inspired by

https://marketplace.visualstudio.com/items?itemName=proverbialninja.svelte-extractor

Known Issues

Ternary if in prop

Example: <Button color={darkTheme ? black : white} />

Expected: detect darkTheme, black, white variables
Actual: detects darkTheme, white variables

Function declaration in prop

TODO: Add example and write tests for this case

Release Notes

0.0.2

Initial release of alpha version of extension

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft