DEV Community

Gilad Lekner
Gilad Lekner

Posted on

Created a React/Redux Component generator

Its very helpful to me so I thought i might as well share it. The generator creates connected React components with Domain-Driven file structure and with prewritten templates. All templates can be replaced with your own! Any feedback is appreciated!

$ tree
.
├── Component.fixtures.js
├── Component.js
├── ComponentActions.js
├── ComponentConstants.js
├── ComponentHelper.js
├── ComponentReducer.js
├── ComponentSelectors.js
├── __tests__
│   ├── Component.test.js
│   ├── ComponentActions.test.js
│   ├── ComponentIntegration.test.js
│   ├── ComponentReducer.test.js
│   └── ComponentSelectors.test.js
├── component.scss
└── index.js

Enter fullscreen mode Exit fullscreen mode

https://github.com/glekner/generator-react-domain

Top comments (3)

Collapse
 
clamstew profile image
Clay Stewart • Edited

This is great. I was gonna do some scripts like this for some of our repo patterns - with only slightly different directory structures. This will be a great jumping point.

Collapse
 
glekner profile image
Gilad Lekner

Thanks!

I thought about supporting more structures, how is your structure different?

Collapse
 
clamstew profile image
Clay Stewart

Usually we’ll start with the component containing the emotion css as well as the connected component wrapper. And the reducer file has selectors and actions. Only big modules get there on files for each piece.