Live data from Hacker News

SVG2JSX – Convert SVG to Valid React SVG

svg2jsx.herokuapp.com

1–10 of 30 posts

Re: SVG2JSX – Convert SVG to Valid React SVG

#5
For 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

#6
post #3

I'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

#7
post #3

I'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

#10
React 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.

Post reply on HN