$ npm install -g fractureinc/new-react-component-cli#v2.5.9
$ new-component Button
Your project will now have a new directory at src/components/Button
with generated files:
src
└── components
└── Button
├── Button.fixtures.tsx
├── Button.stories.tsx
├── Button.style.tsx
├── Button.test.tsx
├── Button.tsx
└── index.tsx
The
index.tsx
allows you toimport
from the directory (eg.import Button from 'components/Button'
), while havingButton.tsx
means that you're never lost in a sea ofindex.tsx
files in your editor.