Parcel

SVGR can be used as a parcel plugin, this way you can import your SVG directly as a React Component.

Install

npm install @svgr/parcel-plugin-svgr
# or use yarn
yarn add @svgr/parcel-plugin-svgr

Usage

Parcel automatically detects plugin, so just import SVG in your code:

import Star from './star.svg'
const App = () => (
<div>
<Star />
</div>
)