Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add more than one on page. #87

Closed
pauldcollins opened this issue Nov 6, 2017 · 2 comments
Closed

Can't add more than one on page. #87

pauldcollins opened this issue Nov 6, 2017 · 2 comments

Comments

@pauldcollins
Copy link

I'm trying to import and display multiple SVGs in the same component, but it's actually just showing the first one duplicated every time, instead of two individual SVGs. Here is my code:

import React, { Component } from 'react';

import Account from '-!svg-react-loader!./svg/Account.svg';
import Alert from '-!svg-react-loader!./svg/Alert.svg';

<div className="col-lg-1">
  <Account className="icon iconAccount" />
</div>

<div className="col-lg-1">
  <Alert className="icon" />
</div>

Can we only have one instance of an SVG per page?

@kompot
Copy link

kompot commented Nov 13, 2017

I guess you might be hitting this problem
svg/svgo#674
and this might be a solution
svg/svgo#674 (comment)

@pauldcollins
Copy link
Author

Hi @kompot

Thanks for this, that is definitely a solution, and I'll implement it. Much appreciated.

In the meantime, I went through and saved out all the SVGs again from Illustrator (instead of Sketch), cleaning them up and removing the IDs - as they weren't needed.

Thanks for your help. I'll close this off now.
Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants