Sometimes you need to modifiy code depending on which target it is running in. Say you are writing a :browser
app but parts of the code should also work in :react-native
. The way I deal with this by abstracting out the relevant bits and either providing separate implementations of a protocol or just plain functions.
;; shared ns that defines the "interface"
;; with actual implementation added later
(ns my.app.env)