Package Exports
- svg-inline-react
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (svg-inline-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
svg-inline-react
: Inline SVG wrapper component for React
This component wraps dangerouslyInnerHTML
prop for easier use. Inlining SVGs have many benefits and cons too; See "Using SVG" for further detail. Transpiling is not required (written with pre-ES6 syntax).
Usage
You can use svg-inline-loader
with Webpack to inline SVG.
Use like:
var InlineSVG = require('svg-inline-react');
<InlineSVG src={require("svg-inline!icon.svg")} /> // Use with loader
prop element
You can change element where svg included using element
prop, default is <i />
. But self closed tags like img
is not allowed, and an error will be thrown from React side.
Notes
This component was initially included with svg-inline-loader
, but since it is totally diffrent domain, I moved this component to separate package. Any suggestion or pull request to improve this component would be welcome!