When I need to quickly knock up a bunch of React components, I like to use my command line. This is how I create a directory structure, where each element has its own folder. Let's say I want something like this:
my-web-app/src
├── App
│ └── App.jsx
├── CtaButton
│ └── CtaButton.jsx
├── CurrencyBar
│ └── CurrencyBar.jsx
├── Discount
│ └── Discount.jsx
├── DomainForm
│ └── DomainForm.jsx
├── DomainInput
│ └── DomainInput.jsx
├── Header
│ └── Header.jsx
├── RadioButton
│ └── RadioButton.jsx
└── Results
└── Results.jsx
I'd go to the src
folder:
cd my-web-app/src
Create all folders:
md App CtaButton CurrencyBar Discount DomainForm DomainInput Header RadioButton Results
And then run the following command to create all the JSX files within their folders, keeping the same name as the folders.
find . -type d | xargs -I{} basename {} | xargs -I_ touch _/_.jsx
Cover image: Variegated Aerialist, Emma Plunkett Art © 2019
Top comments (0)