Last active
April 14, 2018 01:08
-
-
Save kaelfeitosa/3058cee098964a218296e044fca1c208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// singleton export | |
const api = axios.create({ | |
bar: 'foo' | |
}); | |
export default api; | |
// build export | |
const api = () => { | |
return axios.create({ | |
bar: 'foo' | |
}); | |
} | |
export default api; | |
// build singleton export | |
let _api; | |
const api = () => { | |
return _api ? _api : _api = axios.create({ | |
bar: 'foo' | |
}); | |
} | |
export default api; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment