Sometimes, we want to use ES6 import alias syntax for React components.
In this article, we’ll look at how to use ES6 import alias syntax for React components.
How to use ES6 import alias syntax for React components?
To use ES6 import alias syntax for React components, we can use the as
keyword.
For instance, we write
import { default as StyledLibrary } from "component-library";
to import a default export from the component-library
module.
We add a default export with
export default StyledLibrary;
Conclusion
To use ES6 import alias syntax for React components, we can use the as
keyword.