Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Conversation

@shapkarin
Copy link

@shapkarin shapkarin commented Apr 14, 2020

SVG Sprite Loader

Hello. I was using this plugin for some time and it's seems to be useful and handy.
I use it in that way:

import React from 'react';

const svgModules = require.context('Images/sprite', false, /\.svg$/);

svgModules.keys().forEach(svgModules);

const Icon = function ({ name, ...rest }) {
  return (
    <svg {...rest}>
      <use xlinkHref={ `#${ name }` } />
    </svg>
  );
};

Hello. I was using this plugin for some time and it's seems to be useful and handy. 
I use that in this way:

```js
import React from 'react';

const svgModules = require.context('Images/sprite', false, /\.svg$/);

svgModules.keys().forEach(svgModules);

const Icon = function ({ name, ...rest }) {
  return (
    <svg {...rest}>
      <use xlinkHref={ `#${ name }` } />
    </svg>
  );
};

```
@jsf-clabot
Copy link

jsf-clabot commented Apr 14, 2020

CLA assistant check
All committers have signed the CLA.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants