This is a ReactJS Component for SVG file loading by Ajax and DOM injection. This component allow us to insert any SVG file specifying a path and adding a class name for css customization.
Please refer to the example file to see it working.
To run the example:
- Clone the repository
- Execute in console:
cd examplenpm installnpm start
As you will be able to see in example in order to use the component we need to importe it as:
import SvgLoader from 'bv-react-svgloader';
Then, in the render method we can just call it like:
<SvgLoader src='/svg/logo.svg' className="App-logo svg-logo"/>
Install this component is easy, just use npm as:
npm install bv-react-svgloader