React Native
While the Redux use case is more than suitable to use for React Native, we have one unique (and arguably limiting) property of the React Native packager which is: you can't require anything dynamically.
So all of the fancy glob-and-require code that's supposed to glue up many files can't be done. This means more manual work and bookkeeping.
hygen
Injecting with Using hygen
we can help ourselves maintain these dependencies.
Having that every module, component or file that you add is generated with hygen
, we could do something like this:
And here's how inject_component
looks like:
This assumes we have a central file in globs/all-components.js
that we use to glue all components to one re-exportable module:
Running this:
Will build this:
Now we could do something fun like this: