@iconify/react addCollections being called, but still loading from API?
See original GitHub issueAfter the move to webpack v5, I’m seeing my @iconify/react
<InlineIcon>
components are attempting to load my ‘custom’ fonts from the Iconify API provider, despite having called addCollection() at the initialization of my app.
JSON collection:
{ prefix: "custom", icons: { "leaf": {"body": "<path d=\" ... } } }
App initialization, this is called prior to the first render of any component:
import customFont from './path-to-file/custom.json';
import { addCollection } from '@iconify/react';
function initialize()
{
addCollection(customFont)
}
Usage:
import { InlineIcon } from '@iconify/react';
...
render()
{
return ( <InlineIcon icon="custom:leaf" /> );
}
Is anyone else experiencing a similar issue? The rest of our application bundling appears to work as expected.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Iconify for React Function: loadIcons
This tutorial is part of Iconify for React with API functions tutorial. Function loadIcons() retrieves icons from Iconify API. When to use this...
Read more >@iconify/react - npm
Loads icons on demand. No need to bundle icons, component will automatically load icon data for icons that you use from Iconify API....
Read more >[Feature Request] Iconify Support · Issue #7821 · vuetifyjs/vuetify
Another solution is to bundle icons with package instead of loading icons from API. I've built React component that works like that: https:// ......
Read more >Building a Dynamic React Ecommerce Application - ButterCMS
React Ecommerce: Learn how to build a dynamic e-commerce ... because it is an API and just needs to be called and your...
Read more >Integrating Google Maps with React - LogRocket Blog
Google Maps is flexible and powerful enough to handle a wide variety of use cases, and it can provide real value to users...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It has been published to
latest
.Awesome. I’ll keep this for now as a temporary solution, will create proper tests to test it all (should be a challenge in itself because it can only be tested in real browser), then will publish this as
latest
version of all components.In future I think this function will be removed. Instead I’ll attempt to share all data between instances, including functions. But that’s an idea for next major version of components, not minor version.