svg-to-react | Converts SVG assets into accessible React components | Frontend Utils library
kandi X-RAY | svg-to-react Summary
kandi X-RAY | svg-to-react Summary
Converts SVG assets into accessible React components with smart default props
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of svg-to-react
svg-to-react Key Features
svg-to-react Examples and Code Snippets
Community Discussions
Trending Discussions on svg-to-react
QUESTION
So thanks to the svg-to-react-cli script I have 73 components for my icons.
Now, if I want to call these icons, I can individually call each one I want to use. But this is not what I want.
What I want is to call only one component where I add a 'name' value to.
e.g.: < Icon name='Name of one of the 73 components I wish to call' />
How do I loop through multiple components inside a directory, and return them inside a switch case?
This is how all my 73 components inside the directory look like
ANSWER
Answered 2018-Nov-29 at 10:58It's incorrect to rely on directory contents in client-side script because there's none in bundled application.
A proper way is to have a 'barrel' module that re-exports all submodules:
icon-components/index.js
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install svg-to-react
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page