react-svgdom-loader
v3.0.0
Published
Import SVG as ReactDOM element
Downloads
112
Readme
react-svgdom-loader
Import SVG icons as ReactDOM element!
Installation
npm i --save react-svgdom-loader svgo-loader
Usage
Add loader into webpack.config.js
:
loaders: [{
test: /\.svg$/,
loaders: ['react-svgdom', 'svgo']
}]
Then use SVG in component:
import React, { Component } from 'react';
import MyIcon from '../icons/my-icon.svg';
class MyComponent extends Component {
render() {
return (
<div className="my-component">
<MyIcon className="my-icon" />
</div>
);
}
}
Query parameters
className
default: svg-icon
ignoreAttrs
Comma-separated list of attributes for ignoring.
default: id
License
Licensed under the MIT license.