question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using library in a component can be re-use in another component?

See original GitHub issue

So i currently use library to import icons in an individual component like this:

import { library } from "@fortawesome/fontawesome-svg-core";
import {
  faPen,
  faPlus,
  faSearch
} from "@fortawesome/pro-regular-svg-icons";

library.add(faPen, faPlus, faSearch);

And while creating another component which does not related to the one above, i still can use the icons which has been imported previously without import them again. Is this right or i am doing it wrong?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
robmadolecommented, Mar 24, 2020

@kawazoe yep, exactly.

0reactions
silvio-ecommented, Apr 23, 2021

@robmadole

it won’t get duplicated but you should only have one call to library.add()

I just tried to call it twice. First time in my nuxt plugin where I register the FontAwesomeIcon component and a second time in a component which receives data form a CMS with icons names. I would like to add icons in this component to the existing library.

The result is the added icons won’t appear and I get following error:

Could not find one or more icon(s) {
  prefix: 'fas',
  iconName: 'hourglass'
} {}

➡️ But when logging the library I see that they actually got added. Do you have any insights why this is happening and an idea how that could work?

It would make it easier for us adding icons just in our CMS and with a fresh build it would do it automatically for the frontend too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shared Component Library: Share Reusable Components
Here is a short tutorial to how you can use Bit to share the components from your library into your own playlist-like collection...
Read more >
How to Easily Reuse Components Across Projects ... - ITNEXT
How to reuse components across projects and repositories. ... Using Bit, each component in any reposiotry (and library) can be tracked as a ......
Read more >
Reuse Components Across PowerApps With A ... - Bulb Digital
You should create the components directly in the component library when you want to use them across apps.
Read more >
Reusing and sharing React components across applications
In this tutorial, you will learn the best way to create and share reusable components that you can instantly use and easily manage...
Read more >
Make A Power Apps Component Library To Share And Reuse ...
Available To Use In Other Apps – Any component in a component library can used in other apps whereas a component stored inside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found