Reputation: 2743
I am trying to import all icons from different sources as Icons
, something like that:
import * as Icons from {"@fortawesome/fontawesome-free-solid","@fortawesome/fontawesome-free-regular","@fortawesome/fontawesome-free-brands"}
but it is not a correct syntax.
Upvotes: 2
Views: 258
Reputation: 2947
Create an aggregator file i.e. icons.js
import like from 'likeIcon.js';
import menu from 'menuIcon.js';
import bird from 'birdIcon.js';
export default {
like,
menu,
bird
};
Then you can import all the icons you need
import {like, bird} from './icons.js';
You can also import the icons object
import icons from './icons.js'
and then use them as icons.like
or icons.menu
Upvotes: 3