React Component Creator is a Visual Studio Code extension that helps you quickly generate a folder structure with React component files. This extension simplifies the process of creating new React components by generating boilerplate code and file structure.
Features
Generates a folder with the following files:
ComponentName.tsx
ComponentName.styles.ts
index.ts
ComponentName.types.ts
Allows you to customize the templates for these files using a webview-based editor.
Installation
Install the extension from the Visual Studio Code Marketplace.
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
Type Create Component or Create Component from Folder and follow the prompts.
Usage
Create Component using Command Palette:
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
Type Create Component and follow the prompts to enter the component name.
The extension will generate the necessary files and folder structure in the current directory.
Create Component from Folder:
Right-click on a folder in the Explorer pane.
Select Create Component from Folder.
Enter the name of the component.
The extension will generate the necessary files and folder structure in the selected directory.
Edit Templates using Command Palette:
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
Type Edit Templates and select the command.
A webview will open, allowing you to edit the templates for the component files.
Click Save Templates to save your changes.
Edit Templates using Context Menu:
Right-click on a folder in the Explorer pane.
Select Edit Templates.
A webview will open, allowing you to edit the templates for the component files.
Click Save Templates to save your changes.
Configuration
You can configure the templates for the files in the extension settings or using the webview editor. Go to File > Preferences > Settings and search for Component Generator Templates. Here you can customize the templates for the component files.
componentGenerator.templates.component: Template for the component .tsx file.
componentGenerator.templates.styles: Template for the component styles file.
componentGenerator.templates.index: Template for the component index file.
componentGenerator.templates.types: Template for the component types file.