My team is building 2 applications:
- A full blown react web app (which is non responsive)
- A mobile application which is wrapped using PhoneGap
As you can imagine, the UI for both of these are completely different. However, the service layer is exactly the same. In other words, they share the actions, action creators and the reducers.
For shareability, I've extracted the services into a separate npm package, which has a separate set of unit tests and a build system. I simply import the necessary actions/reducers in directly from the package.
There are certain problems with this approach:
- Having to work across different repositories (and separate branches sometimes) makes it so much harder to work quickly
- Need to build and push to github to have the changes built by babel/webpack before consuming via npm
- Inability to debug the service layer when working from the UI (I could add the source maps to the distribution files I guess?)
But, I was wondering if any of you guys have a better solution/approach to solve this problem.
Thanks!