Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>React Component GeneratorNew to Visual Studio Code? Get it now.
React Component Generator

React Component Generator

Pulkit Banta

|
289 installs
| (1) | Free
React component boilerplate generator with typescript
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

react-component-generator

React component boilerplate code generator with typescript.

Create React Component Example

How to use

  • Install the extension here.
  • Open command pallete Ctrl + Shift + P (windows) or Cmd + Shift + P (mac).
  • Search Create React Component and hit enter.
  • Enter path of the component eg src/components. This is the parent folder inside which your component will be created.
  • Enter name of the component eg Header. This is the component name and the folder which will contain the component

Generated Code Structure

Test file with jest and react-testing library

import { render } from '@test-utils';
import { Header } from './Header';

describe('Header', () => {
 it('should render properly', () => {
  const { container } = render(<Header />);
  expect(container).toMatchSnapshot();
 });
});

Component file

import { FC, memo } from 'react';

export const Header: FC = memo(() => {
 return <></>;
});

Header.displayName = 'Header';

index.js

export { Header as default } from './Header';

types.js

export type Props = {
 // component prop type
 click: () => void
};

Contributing

The project is open to all sort of contributions.

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