-
Notifications
You must be signed in to change notification settings - Fork 299
How to import svg as component #223
Comments
I'm having the same problem |
I'm facing the same problem !! |
@transitive-bullshit seems like the |
@transitive-bullshit deep apologies for double ping Just wanted to bring the attention to PR above Thank you for the great tool! |
Thanks a lot @bohdanbirdie you saved me ! Can't wait to test when it's released ~ |
@DDDDDanica you can use my fork while the package is not published. (or use original git repo) |
Hey @bohdanbirdie Any ideas? |
@DDDDDanica yes, this was also my problem import { ReactComponent as Bell } from '../../assets/svg/bell.svg'; |
@bohdanbirdie Hi,
It happens in Icon component, and in storybook i direct call
It works to generate the stories, but failed in storyshots (jest). |
It should be like this only. If you want to use a single component ( import { ReactComponent as Bell } from '../../assets/svg/bell.svg';
const MyComp = () => {
return <Bell />
} |
Thanks @bohdanbirdie Eventually i abandoned storyshots and just append snapshots to component itself. Works for me. Thanks for your help ! |
Using CRA, i was able to import svg like component and inline it:
import { ReactComponent as skip } from '../../../assets/icons/skip.svg';
But if i try it, i will get an error:
If i import like this:
import skip from '../../../assets/icons/skip.svg';
i will get link to svg, but i need inline svg code.
The text was updated successfully, but these errors were encountered: