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 on

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.

We are hiring! Do you want to be our Senior Platform Engineer? Are you capable of chipping in across sysadmin, ops, and site reliability work, while supporting the open source stack that runs DEV and other communities?

This role might just be for you!

Apply now