Created
March 1, 2019 17:19
-
-
Save kevincoleman/e460119393c8d6532691f89086fe495c to your computer and use it in GitHub Desktop.
Three import styles
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
// way #1 | |
import Storage from "storage"; | |
class MyClass { | |
setCache(data) { | |
return Storage.insert(data); | |
} | |
} | |
// way #2 | |
import Storage from "storage"; | |
const storage = new Storage(); | |
class MyClass { | |
setCache(data) { | |
return storage.insert(data); | |
} | |
} | |
// way #3 | |
import Storage from "storage"; | |
const storage = new Storage(); | |
class MyClass { | |
constructor(storage) { | |
this.storage = storage; | |
} | |
setCache(data) { | |
return storage.insert(data); | |
} | |
} |
nathan-isaac
commented
Mar 15, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment