I’m working on an application with two very different incarnations:
- a React Native app that includes certain processing services because offline use is mandatory
- a React Native Web app in which these services are accessed via an Express API for better security and performance
For the RN app, my code is something like this:
import summarize from '../services/summarize';
const response = summarize({ factors })
For the RNW app, it's:
const response = axios.put(`${ROOT_URL}/summarize`, { factors });
What's a clean way to handle such different code? I'm currently commenting/uncommenting one version or the other depending on my build target, but there must be better ways.