The extension helps you to create a React component with one-click. There are also options to create Remix and TypeScript React components.
Please click here for React Native version
The extension automatically creates folder for react component containing :
index.(js|ts)ComponentName.(jsx|tsx)ComponentName.styles.(js|ts)(forstyled-component oremotionoption)ComponentName.css(forstandardstyle option)ComponentName.module.css(you'll need to set prefix from the extension settings)ComponentName.scss(forsassstyle option)ComponentName.less(forlessstyle option)
Install through VS Code extensions. Search for VSCode React Component Generator
Visual Studio Code Market Place: VSCode React Component Generator
Can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install abdullahceylan.vscode-react-component-generator-
Right click on the file or folder in the file explorer
-
Select one of following options:
- "New React Stateless Component"
- "New React Stateless Component with Redux"
- "New React TypeScript Component"
- "New React TypeScript Remix Component"
- "New React TypeScript Remix Route Component"
-
Enter a component name in the pop up in camelCase or PascalCase. If you enter the component name as in camelCase, then extension will convert it PascalCase automatically.
-
For Remix Route component, enter the route file name and the file will be created with
app.prefix. i.e.:- demoRoute -> app.demo.route.ts
- demoRouteChild -> app.demo.route.child.ts
Creating a TypeScript React Component, Remix TypeScript Component and React TypeScript Route Component
You can access to the extension's settings through VSCode settings. You can customize:
Generate or not separate folder for newly created component
Controls the quotes for the imports in the files. Valid options:
- "single" - e.g.: import React from
'react' - "double" - e.g.: import React from
"react"
The lifecycle type of generated component. Valid options:
- "legacy" - Contains
componentWillReceiveProps,componentWillMount - "reactv16" - Contains
getSnapshotBeforeUpdate,getDerivedStateFromProps,getDerivedStateFromError,componentDidCatchand removescomponentWillReceivePropsandcomponentWillMount
Whether to generate component's index file or not.
The extension of generated component index file. e.g.: index.(extension)
Whether to generate component's main file or not.
The extension of generated component file. e.g.: ComponentName.(extension)
Whether to generate component's stylesheet file or not.
The extension of generated stylesheet file. e.g.: ComponentName.styles.(extension)
The suffix to add to the end of the stylesheet filename. Default: None
You have option to select CSS modules and Styled Component
The type of stylesheet file to create. Valid options:
- "standard (.css)" - ComponentName.
css(You can use this for CSS modules as well) - "styled-components/emotion (.js)" - ComponentName.styles.
js - "standard (.css)" - ComponentName.styles.
css - "sass (.scss)" - ComponentName.styles.
sass - "less (.less)" - ComponentName.styles.
less
Please report here





