Skip to content

PulkitBanta/react-component-generator-vscode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c5c6efb · Jan 29, 2022

History

25 Commits
Nov 24, 2021
Nov 14, 2021
Jan 15, 2022
Jan 29, 2022
Jan 15, 2022
Nov 19, 2021
Nov 14, 2021
Oct 15, 2021
Oct 15, 2021
Oct 15, 2021
Nov 14, 2021
Nov 2, 2021
Jan 15, 2022
Nov 14, 2021
Jan 29, 2022
Nov 14, 2021
Nov 14, 2021
Nov 14, 2021

Repository files navigation

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.