Last active
October 9, 2020 12:42
-
-
Save Quixomatic/8b913a85d4c770298f8aebce404fd9b4 to your computer and use it in GitHub Desktop.
JAVASCRIPT: Dynamically import something in es6
This file contains hidden or 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
const getAsyncImport = async () => { | |
try { | |
const dynamicThing = 'faCoffee'; | |
const something = await import(`/${dynamicThing}`); | |
console.log(something); | |
} catch (error) { | |
alert('it did not import properly!'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment