@jmshal/react-inline-svg
v4.0.0-rc.1
Published
A simple and lightweight React component for loading SVG files so they can be styled with CSS.
Downloads
265
Readme
@jmshal/react-inline-svg
A simple and lightweight React component for loading SVG files so they can be styled with CSS.
Installation
$ npm install --save @jmshal/react-inline-svg
Basic usage
import { InlineSVG } from '@jmshal/react-inline-svg';
// ...
<InlineSVG
src={require('./path/to/icon.svg')}
className={css.Example}
/>
Preloading
import { preload } from '@jmshal/react-inline-svg';
preload('./path/to/icon.svg')
.then(() => console.log('icon.svg has been preloaded'));
License
MIT ❤️