ReactJS + SVG Files Component

ReactJS + SVG Files Component

Hi there!

Today I will present this awesome React component that will allow us to include any SVG file via Ajax and inject it to the DOM.

This component offer us 3 important advantage:

-. First, we don't need any other module to use it.

-. Second, the files will be loaded by Ajax and inserted in the DOM.

-. And thirst, we can customize them with CSS.

In order to install the component we just execute

npm install bv-react-svgloader

inside of our React project.

Then we need to include the module where we need it

import SvgLoader from 'bv-react-svgloader';

and of course insert it in our render function like

<SvgLoader src='/svg/logo.svg' className="svg-logo"/>

Please refer to the repo to check an example or just give a close look to the code:

Thanks!

To view or add a comment, sign in

More articles by Blas Vicco

  • I Built an AI-Augmented Engineering System So My Team Could Spend More Time on Judgment, Not Friction

    What would an engineering team look like if AI handled everything except the decisions that actually require human…

    2 Comments
  • GPU Image correlation

    Hi there. Long time without posting anything =) I'm back with a very cool python lib / script to find differences…

  • GID Problem Type for Steady State Heat Transfer 2D

    Hi fellows, this time I bring you an awesome project I developed with a didactic purpose to help anyone in the engineer…

  • NodeJS + Pipeline Pattern Design

    Hello there, Today I will explain an implementation of Pipeline Pattern Design using Promise and OOP for NodeJS. The…

  • Drupal 8 + Search API Solr + Performance

    Hi there, for those who are struggling with the module Search API Solr in Views, here I'm leaving an extension of the…

  • Deep Learning in a Simple XOR Problem

    Introduction: The most wonderful gift that my parents gave me was that from the very beginning they made me a reader. I…

  • TinyBoss

    Check this simple example of AI (artificial intelligence) on microorganism game. This video is about TinyBoss, a…

Explore content categories