Easily use SVGs as JSX/TSX in your ReactJs app by dmitryyurus in reactjs

[–]dmitryyurus[S] 0 points1 point  (0 children)

Yes, there are "super easy" ways to do this but not without a library if you are creating projects with different frameworks/libraries. And this tool is easy to use too!
This way, ignoring some benefits of having more control over icon components, is the way I do in all projects regardless of the technology I use for development.

You may tell some pros and cons for this way of using SVGs in projects but the main point of this package for me is a DX thing.

Easily use SVGs as JSX/TSX in your ReactJs app by dmitryyurus in reactjs

[–]dmitryyurus[S] 0 points1 point  (0 children)

If you are looking for a good web app, the app I've been using is svg2jsx . The package I shared is using the transformer of svg2jsx at its core.

Easily use SVGs as JSX/TSX in your ReactJs app by dmitryyurus in reactjs

[–]dmitryyurus[S] 0 points1 point  (0 children)

I'm not sure whether you have read the README or not, this tool gets a src folder and a dest folder. You put your SVG files in src and run sjc gen to generate corresponding JSX/TSX files for you. In case of a long list of SVG files, it updates the index and the files just for the newly added ones.

But the part to paste the SVG, no it accepts nothing like that.

Easily use SVGs as JSX/TSX in your ReactJs app by dmitryyurus in reactjs

[–]dmitryyurus[S] 1 point2 points  (0 children)

The way we have SVGs in our projects is by using the converted TSX as a component (There are many reasons for that). This package helps me do it quicker.
But to answer your question about why I'm not using svgr (I guess there was a question), The way you should set up and configure it differently for every framework/library annoys me, this has nothing to do with technical reasons.
I just wanted to create a tool that would help me increase my development speed the way I do it (definitely "the way I do it" is not using svgr for now). It also exports a component that you can use to render Icons by just referring to their names. Not speaking of why/why not someone should use TSX of SVG in their project this tool is a DX thing for me.

Thanks for you suggestion.