SVG2JSX – Convert SVG to Valid React SVG
svg2jsx.herokuapp.com
SVG2JSX – Convert SVG to Valid React SVG
1–10 of 30 posts
Re: SVG2JSX – Convert SVG to Valid React SVG
#2The site would be much better if it loaded a sample SVG by default so I don't have to hunt down the source for an SVG that I have lying around (or on the internet).
Re: SVG2JSX – Convert SVG to Valid React SVG
#3I'm curious: what's the main use-case for this functionality?
Particularly given it's a lossy transformation, I can't think of any situation where I'd use this.
Re: SVG2JSX – Convert SVG to Valid React SVG
#4Related: Babel transform to load SVGs as React components: https://github.com/jhamlet/svg-react-loader
Re: SVG2JSX – Convert SVG to Valid React SVG
#5For anyone who looked at the repository linked from the Heroku app and was confused as to how this works (or indeed the extent of what it does), the actual transformation is being done server-side, using this: https://github.com/balajmarius/svg-to-jsx/blob/master/index.... (from the same author).
Re: SVG2JSX – Convert SVG to Valid React SVG
#6I'm curious: what's the main use-case for this functionality? Particularly given it's a lossy transformation, I can't think of any situation where I'd use this.
Super useful if you need to inline some SVG in a react app. I recently learned about the benefits of inline SVG thanks to front-end center and started using similar to OP's tool for that.
Re: SVG2JSX – Convert SVG to Valid React SVG
#7I'm curious: what's the main use-case for this functionality? Particularly given it's a lossy transformation, I can't think of any situation where I'd use this.
It seems useful if you have an SVG that has been produced in a vector graphics editor that you want in a JSX format to make pieces interactive using React.
Re: SVG2JSX – Convert SVG to Valid React SVG
#8I have not yet tried this OP's tool, but I've been using something similar (http://svg-jsx.patmoody.com/) and I'm very happy with the utility. Next time I need to inline SVG in react I will use this one.
Re: SVG2JSX – Convert SVG to Valid React SVG
#9The site would be much better if it loaded a sample SVG by default so I don't have to hunt down the source for an SVG that I have lying around (or on the internet).
[deleted]
Re: SVG2JSX – Convert SVG to Valid React SVG
#10React is such a nice way to make SVGs generally. My team was building a microservices to generate our dynamic images, then had the realization: our frontend is React, and we can make these images client-side as inline SVGs (or server side if we need using the same code).
There's some browser compatibility issues we have to stay on top of, but overall it's been a blast.