Languages
[Edit]
EN

React - convert SVG graphics to React SVG Components

9 points
Created by:
lena
714

This article shows how to convert SVG graphics to React SVG Components under Linux. The article shows how to use svgr tool from the command line.

Quick solution (run following command):

 

Read the next sections to know:

  1. how to install SVGR with npm,
  2. what @svgr/cli tool does with file,
  3. useful resources.

1. Installation example

Edit

    Simple instruction how to install SVGR globally:

    Note: you can install it locally in project as development tool with npm install @svgr/cli --save-dev.

    Example installation output:

    2. Usage example

    Edit

    SVG image conversion to React componet can be made with following command:

    Example input (icon.svg file):

    Example output (icon.js file):

    3. Useful resources

    Edit
    1. Project Homepage
    2. Online converter - Playground
    3. GitHub Site
    4. NPM JS Page
    1
    Donate to Dirask
    Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
    Join to our subscribers to be up to date with content, news and offers.

    ReactJS

    React - convert SVG graphics to React SVG Components
    Native Advertising
    🚀
    Get your tech brand or product in front of software developers.
    For more information Contact us
    Dirask - we help you to
    solve coding problems.
    Ask question.

    ❤️💻 🙂

    Join