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

SVG Sprite from Component or string #205

Open
oknoorap opened this issue Sep 16, 2020 · 0 comments
Open

SVG Sprite from Component or string #205

oknoorap opened this issue Sep 16, 2020 · 0 comments

Comments

@oknoorap
Copy link

oknoorap commented Sep 16, 2020

I'm using react-icons as Component, then import MdStar as star icon

I want to render 5 stars or 10 stars, I don't want to renders SVG as a repetitive components, instead I want to use SVG as a sprite,

  1. Is it possible?
  2. Or if it's not possible can I create SVG string as sprite?

example:

import { renderToString } from "react-dom/server";
import { MdStar as StarIcon } from "react-icons/md";

//...
renderToString(<StarIcon />);
// output: <svg.... />
@oknoorap oknoorap changed the title SVG Sprite from Component or String SVG Sprite from Component or string Sep 16, 2020
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

1 participant