You need SVG icons in React. One camp says install SVGR and configure your build. The other says paste it into a converter and move on. Both are right, for different projects, and the choice is easier than the arguments suggest.
SVGR vs an Online SVG to JSX Converter: The Short Answer
SVGR for icon sets you maintain. An online converter for one-off icons and builds you cannot change.
| SVGR | Online converter | |
|---|---|---|
| Setup | Build configuration required | None |
| Re-export handling | Automatic | Manual re-conversion |
| Optimisation | SVGO built in | Separate step |
| Works in any codebase | No — needs config access | Yes |
| Editable after conversion | Not directly | Yes, it is just code |
| Framework support | React and React Native | Depends on the tool |
Notice that neither column is empty. This is not a case where one option is simply better.
Where SVGR Genuinely Wins
Anywhere icons arrive repeatedly from a design tool.
A designer re-exports the icon set, the build regenerates every component, and nobody touches a line of code. That workflow is the reason SVGR exists.
Three other advantages worth naming:
- SVGO runs automatically. Editor metadata, empty groups, and twelve decimal places all disappear.
- Ids get stripped or made unique. This prevents the duplicate-mask-id bug that only appears when two icons share a page.
- Output stays consistent. One template means every icon in your library has the same shape.
For a design system, none of this is optional. Hand-converting a hundred icons and keeping them in sync is a job nobody should have.
Where an SVGR Alternative Makes More Sense
When you cannot or should not touch the build.
Four situations we run into constantly:
- One icon, once. Adding a build dependency for a single illustration is not proportionate.
- A codebase you do not own. Client projects, legacy apps, locked platform builds.
- Icons you need to edit afterwards. Adding a class to one path, splitting a group, wiring a prop to a fill.
- Learning what actually changed. Seeing the output side by side teaches the attribute rules faster than reading them.
That third point is the one people underrate. SVGR output is generated, so editing it means editing the source file and regenerating. A pasted component is just code you own.
Our SVG to JSX converter runs entirely in the browser, which also means unreleased artwork never leaves your machine.
The SVGR Webpack Config Problem Nobody Warns About
The import syntax everyone copies only works where SVGR is already wired in.
import { ReactComponent as Icon } from './icon.svg';
Create React App shipped SVGR configured by default, so years of tutorials assume that line just works.
It does not in Vite, which needs vite-plugin-svgr. It does not in a bare webpack setup. In Next.js you configure the loader yourself.
When it is missing, you do not get an error. You get a URL string, and React renders the file path as text. We have watched that cost an afternoon more than once.
What Neither Approach Fixes
Both leave the same problems for you.
- Hard-coded fills. If the export bakes in a colour,
currentColorwill never take effect. - Accessibility. Neither adds a title, a role, or an aria-hidden. That is on you.
- Bundle size from barrels. A hundred icons re-exported through one file can ship entirely unless the package is marked side-effect free.
- React Native gaps. Filters and SMIL animation have no equivalent regardless of which tool converted the file.
That last one matters if you target mobile. Our SVG to React Native converter at least flags the unsupported elements up front.
How We Actually Split It
Most teams end up using both, and that is a reasonable outcome.
SVGR owns the design-system icon set, where automation and consistency pay for the configuration. One-off illustrations, client work, and quick experiments go through a converter.
If you are typing your components, the SVG to TSX converter writes the props interface too — something SVGR needs a template tweak to match.
And on a Vue codebase, none of this applies: Vue components need no attribute renaming at all.
Wrapping Up
Looking for an SVGR alternative usually means one of two things: you have a single icon, or you cannot change the build. In both cases a converter is the faster, smaller answer.
Running a design system with icons arriving every sprint? Configure SVGR and stop thinking about it.
Either way, learn the attribute rules — why React needs camelCase explains what both tools are doing under the hood, and the seven ways to use SVG in React covers where components fit among the alternatives.
