Tech
What Changes When Converting SVG to React Components (JSX & TSX)
TL;DR
SVG attributes like stroke-width become strokeWidth in JSX.
class → className .
Numeric values become {expressions} .
Inline styles become objects.
xmlns and XML comments are removed.
The converter outputs either JSX or TSX with SVGProps .
Use automation (SVGR or SVGCode) for large icon sets.
Import only what you need to keep bundle sizes small.
Converting an SVG file into a React component is more than just pasting markup into a .jsx ...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to