To use SVG images inline in Next.js apps
- install babel-plugin-inline-react-svg
- add the following .babelrc file to the root of your app
{ 'presets': [ 'next/babel' ], 'plugins': [ 'inline-react-svg' ] }
- restart your app
- import SVG as react component
import Cat from '../static/images/cat.svg';
Reference:
Recent Comments