What is @svgr/plugin-svgo?
The @svgr/plugin-svgo package is a plugin for SVGR that allows you to optimize SVG files using SVGO during the transformation of SVGs into React components. This optimization can include removing unnecessary attributes, minifying the file, and more, which can result in smaller and more efficient SVG components for use in web applications.
Optimize SVGs during conversion to React components
This feature allows you to optimize SVG files using SVGO while converting them into React components. The code sample demonstrates how to use the SVGR core library with the SVGO plugin to optimize an SVG string.
import svgr from '@svgr/core';
import svgoPlugin from '@svgr/plugin-svgo';
const svgCode = '<svg>...</svg>';
const optimizedComponent = svgr(svgCode, { plugins: [svgoPlugin()] });
console.log(optimizedComponent);