Socket
Socket
Sign inDemoInstall

svg-react-loader

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-react-loader

A Webpack Loader to turn SVGs into React Components


Version published
Weekly downloads
114K
increased by10%
Maintainers
1
Weekly downloads
 
Created

What is svg-react-loader?

The svg-react-loader npm package is a Webpack loader that allows you to import SVG files as React components. This enables you to use SVGs in your React applications with ease, providing the ability to manipulate them using React's props and state.

What are svg-react-loader's main functionalities?

Importing SVG as React Component

This feature allows you to import an SVG file and use it as a React component. You can then manipulate the SVG using standard React props such as width, height, and fill.

import MyIcon from './my-icon.svg';

const App = () => (
  <div>
    <MyIcon width={50} height={50} fill="blue" />
  </div>
);

export default App;

Customizing SVG with Props

This feature demonstrates how you can pass custom props to the imported SVG component, such as className and style, to further customize its appearance.

import MyIcon from './my-icon.svg';

const App = () => (
  <div>
    <MyIcon className="custom-class" style={{ fill: 'red' }} />
  </div>
);

export default App;

Using SVGs in JSX

This feature shows how you can seamlessly integrate SVG components into your JSX, making it easy to include icons and other SVG graphics in your React components.

import MyIcon from './my-icon.svg';

const App = () => (
  <div>
    <h1>Welcome to My App</h1>
    <MyIcon />
  </div>
);

export default App;

Other packages similar to svg-react-loader

Keywords

FAQs

Package last updated on 15 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc