Redux
Redux is the posterchild of hygen
. It doesn't matter what level of granularity you select for your Redux architecture, you're still going to end up with a lot of boilerplate.
For my app architecture I mostly choose ducks, which helps remove a little bit of boilerplate and have modularity baked in.
My typical Redux architecture would look like this:
Adding a Module
Being a modular architecture, there's a huge plus for adding a module. It just means adding a folder, and index
, view
, state
, perhaps a default component
, a storybook story
, and wiring every thing togather such as a reducer
, exported actions
and more in boot.js
. Fun.
Should be a breeze with hygen
. Here's how your templates look like:
Here's how index
looks like:
A similar trick would do for view
and state
.
How would we add a require line given that boot.js
looks like this?
Let's build inject_boot.ejs.t
. We have to use inject: true
because this is an inject template and to locate our injected line after const modules =...
:
After running it, we end up with this:
And we're done! Generating a new module is saying this: