The extension provides refactoring tools for your React codebase
The extension provides refactoring tools for your React codebase: extract JSX into a new component, convert Class Components to Functional Components, wrapping with Hooks and more!
Go to the link below and click
Glean allows easy extraction of JSX into new React components (in the same or other file). Just select the JSX to extract, and Glean will handle all the rest:
Glean seamlesly automates convertion of class components to functional component, while take care of all the complexity:
setState calls to
WARNING!!! If You are using React version older than 16.8.0, This refactoring will delete all Lifecycle methods and setState calls!
Rename any state variable and let Glean rename its setter accordingly for You!
Select text and either VSCode's code suggestion (aka "Lightbulb") or Command Pallet ('Extract to File' command) to extract the text.
Determines how the selected code will be exported/imported. Valid options are 'esm' and 'commonjs'.
Determines whether VSCode should switch to target file after extracting.
A list of enabled experimental features. Available experimental features:
Determines whether VSCode should show conversion warning when converting Class Component to Functional Component.
Feel free to open issues or PRs!
In order to start working all you need to do is:
$ git clone [email protected]:wix/vscode-glean.git
$ cd vscode-glean
$ npm install
$ code .
Extension from the dropdown
Extension Tests from the dropdown
Please refer to to the following guide.