News for hackers. Stuff that matters.
Re:Transform SVG into React components by abritinthebay on Monday October 30, 2017 @02:46AM (#15583446)
We do this at my work - it allows easy programmatic inclusion.

We wouldn’t do it if browsers weren’t a buggy mess with the USE tag though (Chrome in particular is a dumpster fire of SVG bugs).

Re:Transform SVG into React components by tehno on Monday October 30, 2017 @02:57AM (#15583471)
Yeah, USE tag is pretty buggy across browsers.

Also, sometime you just need to inline SVG, for example if you want some icon path fill color to change on mouse-over. Easy with inline SVG and CSS rule. Can't really do that (well) with external .svg.

Re:Transform SVG into React components by abritinthebay on Monday October 30, 2017 @06:45AM (#15584097)
We actually had a nice system for that... but again: browser bugs :(

Until browsers collectively get off their asses with SVG (most of these bugs are years old in their big trackers) using React for SVGs is a good workaround.

Re:Transform SVG into React components by Already__Taken on Monday October 30, 2017 @07:07AM (#15584191)
They won't because it seems like they might as well forge ahead with CSS additions and drop an entirely separate renderer. That's what happened to the SVG Animations.

Of course it's not like svg will get removed so Why fight it...

Re:Transform SVG into React components by abritinthebay on Monday October 30, 2017 @07:13PM (#15589828)
It seems they stop work as soon as a feature hits SVG - CSS Animation, Canvas, WebGL... all have open SVG bugs. Some years old.
Re:Transform SVG into React components by josteink on Monday October 30, 2017 @07:36AM (#15584274)
> Easy with inline SVG and CSS rule. Can't really do that (well) with external .svg.

I can see that easily solved much better, cleanly and not to mention lightweight with some CSS rather simple pre-processors in the build process.

Or is your argument that you already have a (React-based) build-process and you'd want to align this with what you have, rather than creating something new and different along-side everything else (despite the result being suboptimal)?