How Import Svg In React. A lightweight alternative solution to svgr is react-svg-loader. Our variable will hold a URL to the SVG icon.
Lastly import the file in your React app. How to import image svg png in a React Component. Import SVG using svg-react-loader - A webpack loader allowing for inline usage of a SVG as a React component as mentioned on the github page.
Npm install --save-dev babel-plugin-inline-react-svg Now lets add that plugin to our babelrc file.